Dynamic Environment Cubemapping [DOWNLOAD]

Posted By: Timothy

Dynamic Environment Cubemapping [DOWNLOAD] - 06/27/11 14:29

Hi,

I recently started to do some Dynamic Cubemapping and combined it with an old Fixed Function Effect by Steempipe (Environment Mapping) from Slin's massive shadercollection.
It uses render to texture, so I think you have to own at least the Commercial edition (or use ChrisB's plugin).
This is made with A7, but it should work with A8 too.

This effect enables an entity to dynamically reflect its environment.
It can f.e. be used for a car body.
Here is a picture:


And here the download link:
edit: http://www.file-upload.net/download-4116565/DEM.rar.html

There is still a problem, which creates graphic bugs by changing the engine resolution. I do not know what creates this problem, it could even be the engine (render to texture) or the shader.

Greetings,

Timothy

Posted By: JibbSmart

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 06/27/11 14:32

Often when changing resolution it's a good idea to recreate render targets. Looking good, though!

Jibb
Posted By: Timothy

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 06/27/11 14:35

Do you mean calling something like "rendered_view.bmap = render;" again after changing the video resolution?
And thank you smile
Posted By: JibbSmart

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 06/27/11 14:37

That wouldn't do it, but... how big are the render targets? It might have to do with bmap_zbuffer (which is supposed to be automatic these days, but I've still found it necessary to call manually at times).

Jibb
Posted By: Timothy

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 06/27/11 14:44

Well it creates a skycube. By changing 2 values in the code you can vary from 768*128 to 6144*1024 maps. But since every frame only one sixth of the "skycube" is being rendered the target map should be 128*128, 256*256, 512*512, 1024*1024 (dependant on your settings).

Edit: In the download it is 512.
Posted By: JibbSmart

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 06/27/11 14:57

Okay, having tried the demo, I don't know why it is but at a complete guess I'd say you might need to call bmap_to_cubemap again after changing resolution.

Also, for the sphere, the view positions seem to be a bit out of place. But it looks good in action, and I hadn't realised how many animations Sid has! I think he should come with the engine.

Jibb
Posted By: Timothy

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 06/27/11 15:02

Ok, thanks for your tip, I will try this.

Yep, Sid is pretty amazing. Generally I think new detailed models should come with the engine.
Posted By: Ch40zzC0d3r

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 02/14/12 17:58

This is awesome!
Please reupload this, I really need this laugh
Posted By: Timothy

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 02/14/12 18:24

No problem. New link is in the first post.
Posted By: Ch40zzC0d3r

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 02/14/12 18:32

Thank you so much!!!! laugh
One question:
I have 2 models. A weapon and the hands. Now I have a scope on the weapon.
How I can assign the material JUST to the mirror-aim-thing from the scope?
Hope there is any way laugh
Thx by the way.
Posted By: Timothy

Re: Dynamic Environment Cubemapping [DOWNLOAD] - 02/14/12 19:16

To do that with a scope I suggest you a different method.
This effect here is for models that reflect everything from all sides - some kind of 3d mirror. A scope only needs the reflection of one side (I think you are talking about its lense).

You have to make a *VIEW which shares the same position as your reflecting part of the scope and which is directed (all the time) at the part that should be reflected.
To show what I mean comment the lines 49 to 65 in the DEM.c file and look at the ball model (this spares a lot of the framerate).
To use this effect on the scope I suggest that you split the model of the scope into 2 parts: the normal scope and its with vec_for_vertex attached reflecting lense. I never did such a thing before though, but it may sound more complicated than it is.
Nevertheless, there may be better solutions.
© 2024 lite-C Forums