Isolate render entitys.

Started by Santiago, April 03, 2020, 03:54:15

Previous topic - Next topic

Santiago


Hi, making a aircraft videogame i found this "dilema"

if need render the cockpit of the airplane, very close to the camera.
and i need to render the scenary, that need to have 100 kms visual horizont, if i flying at 10000 mts altitude, i need to see land, ocean far in the horizont.

so, i cant use this

camerarange camera, 0.1 , 100000    becouse from (10 cm) to (100km) is to much for render.

so i trying to make 2 renders
1 render for the cockpit and airplane (inside and my own airplane)    camerarange(.1,10)
1 render for the scenary camerarange (10,100000)

what do you think?, is good idea? or there is a better way to doit?

and i think, Entityorder don't have a isolated function, like, only render what is in X order specifictly?

what do you think?, is good idea? or there is a better way to doit?



Matty

An easy way....which I've done before is this:

Use a skybox for your cockpit and use entity order.

So render your plane's cockpit all 6 sides of a cube from inside where the pilot sits.

Have the windows transparent.

Save as a set of pngs.

Then load as a skybox which has the entity order set to render after everything (ie in front of everything).

Allow the camera to move rotate inside the skybox and the cockpit will look like it is real 3d.

You can also have it as high poly as you like since it will really just be a cube.

Santiago

thanks for your answer, it is a very clever method!

thanks for the reply!!

RemiD

renderworld() converts the 3d meshes and textures into a 2d image

so you can indeed do 2 renders :
show far away entities / terrain
hide the cockpit
set appropriate camerarange (for far view)
render
copyrect backbuffer to an image (FarViewImage)

hide far away entities / terrain
show cockpit (the transparent areas must be black 0,0,0)
set appropriate camerarange (for near view)
render
copyrect backbuffer to an image (CockpitViewImage)

draw FarViewImage
draw CockpitViewImage
flip()

8)


Santiago

Thanksssss!!! i got to try it right now!

Matty

And you can do RemiDs idea without copyrecting if you use the cameraclsmode option and tell it to not clear the colour buffer after the first rendereorld command.

Santiago

lol, i trying but allways fail.

i don't understand how to use cameraclsmode .

min# = 2
CameraRange cam,min#,visibilidad+EntityY(cam,1)*10
CameraFogRange  cam,min#,(visibilidad+EntityY(cam,1))*2
CameraFogMode cam,True



If vista <> 1 Then   ;vista = 1 (Internal view)

RenderWorld

Else

cut_dist# = 10

;RENDER FAR
min# = cut_dist#
CameraFogMode cam,True
CameraRange cam,min#,visibilidad+EntityY(cam,1)*10
CameraFogRange  cam,min#,(visibilidad+EntityY(cam,1))*2
RenderWorld



;RENDER CLOSE - COCKPIT
CameraClsColor cam,0,0,0
CameraFogMode cam,False
CameraRange cam,.1,cut_dist#
cls_color = 0
CameraClsMode cam,1,0

isolate("cockpit_player",1) ;Hide all entittys

RenderWorld

isolate(0,0)                ;Show entitys

CameraClsMode cam,0,0


End If





And i share this TWO functions,   one to improve the HIDEENTITY or SHOWENTITY function, making similar to entityalpha

Other function is to ISOLATE ENTITYS

Function isolate(entidad$,valor)
;valor = 0 ; MOSTRAR TODO
;valor = 1 ; ISOLAR TODO MENOS ENTIDAD

mostrar ground,valor
mostrar sky,valor

For a.avion = Each avion
mostrar a\pivot,valor

If entidad$ = "cockpit_player" Then
If a\control = "player" Then
ShowEntity a\pivot
End If
End If

Next

For o.obj = Each obj
mostrar o\pivot,valor
Next

For muni.municion = Each municion
mostrar muni\pivot,valor
Next

For part.part = Each part
mostrar part\entidad,valor
Next

For nube.nube = Each nube
mostrar nube\entidad,valor
Next

End Function

Function mostrar(entidad,ocultar)

If entidad <> 0 Then
If ocultar = 1 Then
HideEntity entidad
Else
ShowEntity entidad
End If
End If

End Function