Easiest Way to get a Floor object Reflecting?

rated by 0 users
This post has 7 Replies | 5 Followers

Top 50 Contributor
Posts 105
SunBurn_Community_Licensee
SunBurn_Contributor
FrontlineFire Posted: 06-28-2012 11:58 PM

Quick help. I'm just an artist but I can cut and paste code pretty well!

My floor currently has a color map, normal map, and spec map on it. It doesn't cast shadows (because nothing is below the floor) but recieves them. 

If I wanted to get my "floor" object reflecting what would I do? The reflect refract sample looks ideal more or less.

We are on the deferred renderer now btw.

Thanks!

 

 

 

 

Top 10 Contributor
Posts 5,368
Employee
SunBurn_Studio_Licensee

Hi Frontline,

The Reflection / Refraction example is already setup to render custom scenes.  The only thing you should need to do is replace the water mesh reference with your scene's floor mesh and adjust the reflection plane to the floor's world space position.

Let me know if this helps!

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 25 Contributor
Posts 186
SunBurn_Community_Licensee

This is exactly how we implemented as well:

 

Top 100 Contributor
Posts 43
SunBurn_Community_Licensee
SunBurn_Contributor

hi there, i'm having trouble getting the reflection/refraction sample code to work in my existing game.

we also simply want to do a floor reflection and so i pretty much copied all the necessary code from the sample into my game but i'm unable to see the reflection as expected.

as suggested, i replaced the water mesh reference with our scene's floor mesh and adjust the reflection plane to the floor's world space position.

during the generation of the reflection map, the waterReflectionTarget result is incorrect - when i save this target as JPEG (waterReflectionTarget.GetTexture().SaveAsJpeg()), it contains bits and pieces of the floor, but it's nowhere close to what the reflection should be.  here's what i get:

this target image does get blended on top of the floor properly so i think all the other code is working properly.

i even converted my project from deferred to forward rendering but that didn't help.

as a test, i copied my scene file into the sample and it worked(!) so that ruled out that it's an asset issue.

i debugged this line by line with my game and the sample running at the same time but obviously i missed something.

any help would be appreciated.

thanks!

 

Top 25 Contributor
Posts 182
SunBurn_Pro_Licensee

I had a hard time with Reflections at first as well. I decided to create a resource that demonstrates what I felt I needed to see when I first started with SunBurn. I hope it helps!

http://www.synapsegaming.com/downloads/resource.aspx?guid=5a124973-68e1-48d7-9430-33378294f44f

This example shows how to enable (custom effect) reflections through objects added via the SunBurn editor (rather than added through code)...which makes it easier to understand the render pipeline. Aims to really simplify what you need to see a custom effect in action on an object that was editor added.

*Note reflections will only show correctly in game mode, editor mode will not render the reflections correctly as the editor handles the pipeline in a way optimized for editor use.

Top 100 Contributor
Posts 43
SunBurn_Community_Licensee
SunBurn_Contributor

hi maconbot, thanks for your sample (by the way, it didn't contain a Solution file).

regardless, i really need to get this working through code and not through the Editor.

if you can think of any other reason why the waterReflectionTarget wouldn't be setup properly, please let me know.  the code to create this render target looks incredibly simple.

i just decided to test out the code on my xbox and the reflection works on that platform!  how strange that the PC version behaves differently even though it's the same, shared Draw functionality.

please let me know if you have any ideas.

thanks.

 

Top 25 Contributor
Posts 182
SunBurn_Pro_Licensee

Interesting that you could not see the solution file. Are you perhaps using SunBurn framework edition? My hope was that with this slimmed down version of the example you could easily spot the code mistake and thereby discover the problem. I'm sure it is just the order in which you are processing things.

[EDIT] just got to thinking it could perhaps (though not likely) be a graphics card issue. Mind listing that (which card)?

Top 100 Contributor
Posts 43
SunBurn_Community_Licensee
SunBurn_Contributor

i'm not using the Sunburn Framework Edition and that "ReflectEditor-Indie" file you listed above was not included in your sample that i downloaded - all the other files listed are there.  very strange.

if the issue is the order in which i'm processing things, as you suggest, then i'm assuming it would also not work properly on the xbox version...which it does.

the card  i'm using is the "AMD Radeon HD 6800 Series" but i don't think that's the problem since the original reflection/refraction demo works on my PC.

thanks for your suggestions.

Page 1 of 1 (8 items) | RSS