About Store Forum Documentation Contact



Post Reply 
GUIViewport rendering
Author Message
Rofar Offline
Member

Post: #1
GUIViewport rendering
I expected to find a simple solution to this but I haven't had any luck so far.

I have a GUIViewport rendering a character and it works fine except for the background. The background renders the current world environment (sky and clouds). I want the background to be a solid color, such as black. How do I stop the viewport from rendering the environment?
06-28-2013 10:55 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: GUIViewport rendering
Hello,

You need to adjust the renderer/environment/graphics settings just before the rendering of the secondary viewport.
06-29-2013 10:18 AM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #3
RE: GUIViewport rendering
That's the problem. I haven't figured out how to access the those settings in the code.
06-29-2013 04:37 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #4
RE: GUIViewport rendering
Environment settings:
Game.World.settings().environment-><setting>

You could make an inverted black box with a point light or increased ambient to draw your model in, if you have too many settings to want to bother with.
06-29-2013 04:55 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #5
RE: GUIViewport rendering
Thanks Greg and Rubeus. I was able to get it to work by accessing each of the settings via Game.World.settings().environment and turning each off, followed by calling the "set" method...then turning them back on after rendering the GUIViewport.

It seems like there should be a more straightforward way of doing this. Is this the correct (only) way?
06-29-2013 09:48 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: GUIViewport rendering
That's ok, you can always have 2 environment settings, and activate each before doing different rendering.
Or you can manually adjust the final values of:

// clear
Sky.clear()
AstrosDraw=false;
..

// render
Render..

// restore
Sky.set again
AstrosDraw=true
..
06-30-2013 01:39 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #7
RE: GUIViewport rendering
What I wanted to do all along was create an Environment element for the GUIViewport to use and then set that environment before rendering the viewport and then set the world environment back after rendering.

I'm not sure why I couldn't figure out how to do that because I have now done that and it works perfectly.

Thanks for the help.
06-30-2013 04:53 PM
Find all posts by this user Quote this message in a reply
Post Reply