• Advertisement
Sign in to follow this  

Lots of reflections- how?

This topic is 1922 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A rather vague question about reflections. I hope someone can enlighten me.

I've got no problems with simple mirrors and reflecting water etc but how do you go about creating an environment with lots of reflections (I'm working in XNA)?

I'm thinking of games like Mass Effect 2/3 where nearly every other surface reflects its environment. It seems clear that not ever reflection can be calculated each frame so I'm assuming some kind of pre-calculated approach like environment mapping with cubemaps. Hope someone can fill me in.

Thanks Edited by gchewood

Share this post


Link to post
Share on other sites
Advertisement
I would guess they place cube maps around the scene to do reflections. There is also a screen space reflection technique I heard crytek uses, but it is not very accurate and can get problems, so I don't like it too much.

Share this post


Link to post
Share on other sites
Yeah the common approach is to place reflection probes in the scene, and then pre-render environment maps at the probe locations. When you do this you can also filter the mip levels such that they somewhat match the specular response for different roughness values (specular powers).

Share this post


Link to post
Share on other sites
What MJP said. I can personally confirm ME2/3 both use regular boring cubemaps, but BioWare's art department did a pretty good job hiding this by way of careful region selection. I can't think of any glaring examples where the infinite projection was obvious.

If you want to slap them over things more aggressively, techniques like parallax-corrected cubemaps and other enhanced-projection approaches work really, really well for a large percentage of scenes. They typically aren't much more expensive than the traditional stuff but for mostly-planar surfaces you can get results approaching stencil-masked mirrors.

Share this post


Link to post
Share on other sites

The even more common approach is not to do reflections at all tongue.png


Erm, yeah.....thanks. Very helpful.


Yeah the common approach is to place reflection probes in the scene, and then pre-render environment maps at the probe locations. When you do this you can also filter the mip levels such that they somewhat match the specular response for different roughness values (specular powers).


Well I'm glad I was on the right lines. Is it best to do this programmatically in the engine (and if so, does anyone have the algorithm?) or in something like 3ds max?

Share this post


Link to post
Share on other sites


Yeah the common approach is to place reflection probes in the scene, and then pre-render environment maps at the probe locations. When you do this you can also filter the mip levels such that they somewhat match the specular response for different roughness values (specular powers).


Well I'm glad I was on the right lines. Is it best to do this programmatically in the engine (and if so, does anyone have the algorithm?) or in something like 3ds max?
[/quote]

MJP,

In addition to gchewood's question, I would like to add a question regarding the probe locations. Do you then just setup an orthographic view in all directions (ex. straight up, down, left, right, forward, back) to a single cubemap texture?

Thanks,
Jeff.

Share this post


Link to post
Share on other sites

[quote name='TheChubu' timestamp='1350365229' post='4990630']
The even more common approach is not to do reflections at all tongue.png


Erm, yeah.....thanks. Very helpful.


Yeah the common approach is to place reflection probes in the scene, and then pre-render environment maps at the probe locations. When you do this you can also filter the mip levels such that they somewhat match the specular response for different roughness values (specular powers).


Well I'm glad I was on the right lines. Is it best to do this programmatically in the engine (and if so, does anyone have the algorithm?) or in something like 3ds max?
[/quote]
The consistency is nice, but you'll likely need to add extra shaders, etc. for things to go smoothly. Rendering programs have the advantage of accuracy and sampling flexibility. If one is a win, go with it.

Re: implementation: Render six views along each of the six major axes with 90-degree horizontal and vertical FOV, save into the appropriate face of a cubemap, done. With MAX you can probably accomplish something similar using render-to-texture and MAXScript though it's not something I've ever attempted.

[quote name='jeffkingdev' timestamp='1350392495' post='4990703']


Yeah the common approach is to place reflection probes in the scene, and then pre-render environment maps at the probe locations. When you do this you can also filter the mip levels such that they somewhat match the specular response for different roughness values (specular powers).


Well I'm glad I was on the right lines. Is it best to do this programmatically in the engine (and if so, does anyone have the algorithm?) or in something like 3ds max?
[/quote]

MJP,

In addition to gchewood's question, I would like to add a question regarding the probe locations. Do you then just setup an orthographic view in all directions (ex. straight up, down, left, right, forward, back) to a single cubemap texture?

Thanks,
Jeff.
[/quote]
You probably want to be using projection cameras, but I guess ortho could work too. Likely would look a bit weird, but maybe there's some 'artistic effect' floating around in there someplace :)

Share this post


Link to post
Share on other sites
You'll probably want to capture your probes with the same renderer that you use at runtime. This ensure that you support all of the same shaders/materials/effects/etc. when capturing probes. We do render the probes inside of Maya, using a custom plugin that uses our engine to do the rendering.

To render to a cubemap you'll want use use 6 perspective projections. The easiest way to do it is to line up each cubemap face with a world-space axis, so that you can sample from the probe using a world-space reflection vector. For the projection you'll want to use a FOV of Pi / 2, and an aspect ratio of 1.0.

Share this post


Link to post
Share on other sites

For the projection you'll want to use a FOV of Pi / 2, and an aspect ratio of 1.0.



: Render six views along each of the six major axes with 90-degree horizontal and vertical FOV


Cool, I didn't realise it was that simple. Sounds like the only difficulty lies in dividing up the scenes so the reflections fit nicely. Thanks a lot people, glad to this forum is so reliable.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement