Lots of reflections- how?

Started by
8 comments, last by gchewood 11 years, 6 months ago
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
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.
-----Quat
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).
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.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
The even more common approach is not to do reflections at all :P

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator


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?


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 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 :)
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
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.

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.

This topic is closed to new replies.

Advertisement