Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: rain on May 22, 2014, 08:29:46 AM
-
Hi!
I'm making a store screen menu for the game I'm working on and got stuck with this:
I have a scrollview in which the purchasable items will be displayed via their in-game 3D models and the scrollview obviously doesn't soft clip the 3D objects when it's expected to.
How could i make them get clipped?
Ps: I've never worked with shaders before
-
Set up an off-screen camera to render your 3D objects into render textures, then display render textures using UITexture like normal widgets.
-
Hi is there a way to have the 3D objects clipped and animated. Would this mean constantly updating the UITexture. Is that something that should not be done?
-
Set up a secondary camera with a smaller view rect that renders on top of your 2d UI camera. You can have the 3d track widgets in a list in update with math and then it will behave as you'd imagine.
Rendertextures are a little tricky to work with as they tend to need special shaders because they muck up alpha in textures otherwise.
I'm not sure if you need to update the UITexture contantly if you assign a rendertexture to it, but I*m not sure. I seem to recall that it makes an instance of the source texture, which might break the reference, but arenmook would know better than I do (I don't have the code in front of me).
-
You only have to assign UITexture's texture once, and you can make it a render texture if you want. Updating the render texture will automatically update what's visible, as NGUI only creates the geometry. Render textures are the best way to go, and assuming you render into the texture every frame (as it does by default with every camera), your textures will update with them.