December 04, 2020, 02:43:51 PM

Author Topic: Isolate render entitys.  (Read 576 times)

Offline Santiago

  • Sr. Member
  • ****
  • Posts: 283
  • Blitz3d
    • Indiesoft
Isolate render entitys.
« on: April 03, 2020, 03:54:15 AM »

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?



Offline Matty

  • Hero Member
  • *****
  • Posts: 1258
    • MattiesGames
Re: Isolate render entitys.
« Reply #1 on: April 03, 2020, 09:41:56 AM »
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.

Offline Santiago

  • Sr. Member
  • ****
  • Posts: 283
  • Blitz3d
    • Indiesoft
Re: Isolate render entitys.
« Reply #2 on: April 03, 2020, 03:19:07 PM »
thanks for your answer, it is a very clever method!

thanks for the reply!!

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1081
Re: Isolate render entitys.
« Reply #3 on: April 05, 2020, 08:57:56 AM »
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)

DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Santiago

  • Sr. Member
  • ****
  • Posts: 283
  • Blitz3d
    • Indiesoft
Re: Isolate render entitys.
« Reply #4 on: April 05, 2020, 03:10:43 PM »
Thanksssss!!! i got to try it right now!

Offline Matty

  • Hero Member
  • *****
  • Posts: 1258
    • MattiesGames
Re: Isolate render entitys.
« Reply #5 on: April 05, 2020, 03:13:40 PM »
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.

Offline Santiago

  • Sr. Member
  • ****
  • Posts: 283
  • Blitz3d
    • Indiesoft
Re: Isolate render entitys.
« Reply #6 on: April 05, 2020, 05:02:37 PM »
lol, i trying but allways fail.

i don't understand how to use cameraclsmode .

Code: [Select]
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

Code: [Select]
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



 

SimplePortal 2.3.6 © 2008-2014, SimplePortal