Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rendering previews

Started by Alex Aug 6, 2008 at 10:57 AM 6 replies 2.3k views
Original Post
Alex
Alex
What's the best way to render a preview of a 3D model as part of the interface (on top of a normal scene)? For example, Warcraft 3 (or any strategy game) includes a rendering of the currently selected unit or hero in the interface at the bottom of the screen. How would you get that rendering to work without messing up the lighting, perpective, or projection? Thanks for any help!
--------------------------------------------------Never tempt fate, fate has no willpower.
SiS-Shadowman
SiS-Shadowman
I think a good way would be to setup a new render target and then render your model or building to a texture and when that is done, render that texture before you render the GUI (to get a neat frame around the texture) on the screen:

--Render the scene
--Setup a new render target
--Render the model
--Restore the original render target
--Render the texture
--Render the gui
Alex
Alex
Would that be really slow if I needed to render, say, 40 or so previews every frame?
--------------------------------------------------Never tempt fate, fate has no willpower.
Sneftel
Sneftel
Possibly. In any case, it's not necessary. All you have to do is change the viewport, and change the transformation matrices to match. Both are fairly lightweight state changes.
SiS-Shadowman
SiS-Shadowman
I didn't think about that, however it's not really slow (but maybe overkill). Shadowmapping depends on rendering to a second render target and is being used in alot of games and runs really smooth.
Zipster
Zipster
If there isn't any reason in particular to render to a separate render-target (i.e. post-processing), then I would just do what Sneftel said and render the preview in a smaller viewport. You want to avoid using extra resources whenever possible.
Alex
Alex
Can I render to a viewport that is only a small section of the screen so that perspective doesn't cause the models to appear outside a particular box I have in mind for them?
--------------------------------------------------Never tempt fate, fate has no willpower.
Sneftel
Sneftel
Quote:
Original post by Alex
Can I render to a viewport that is only a small section of the screen so that perspective doesn't cause the models to appear outside a particular box I have in mind for them?

Yes, that's what changing the viewport does.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.