Support => NGUI 3 Support => Topic started by: iceiceice on June 26, 2012, 11:45:02 AM
Title: Scroll view (Panel) with 3d model
Post by: iceiceice on June 26, 2012, 11:45:02 AM
Hello! I have a question to the scroll view (panel). I want a 3d model integrate into the scroll view but my first tests are not successful. The Orc model is scrollable but does not disappear in the corners.
Anybody tips or ideas?
Thanks! Ice
Title: Re: Scroll view (Panel) with 3d model
Post by: ArenMook on June 26, 2012, 04:49:17 PM
You would need to create a special shader to be used by the 3D model that would support clipping. Look at NGUI's existing clipping shaders such as Unlit/Transparent Colored (SoftClip) to see how it's done.
Title: Re: Scroll view (Panel) with 3d model
Post by: joreldraw on September 05, 2012, 03:17:55 AM
Im now something similar on my project, i have a draggable panel with a 3d element in the hierachy. My 3d object now is a single difusse object with a texture. I not need a special material. I don“t know nothing about shaders. :(
Have you any example shader that support clipping?
Thanks in advance.
Title: Re: Scroll view (Panel) with 3d model
Post by: yuewah on September 05, 2012, 04:19:21 AM
you can try the Example 8 - Scroll View (Camera), it works for 3d model, but a little bit trouble to setup.
Title: Re: Scroll view (Panel) with 3d model
Post by: joreldraw on September 05, 2012, 05:23:56 AM
I can try to resstructurate all my hierachys to make work uidragable camera, but now is hard for me (A lot of realtime instantiate objects and data to rebuilt and recode and repositione). I have this in mind for next time. Thanks
But if i can get the shader clip and only change the material of the 3d element i can save so much time.
I test with Unity slice shader and work fine, cut the 3d object: http://docs.unity3d.com/Documentation/Components/SL-SurfaceShaderExamples.html (http://docs.unity3d.com/Documentation/Components/SL-SurfaceShaderExamples.html)
But how i can set this cutt area to an only one areabox similar to clippingPanel effective area?
Title: Re: Scroll view (Panel) with 3d model
Post by: joreldraw on September 06, 2012, 04:49:05 AM
Nobody can help me with the shader?
Title: Re: Scroll view (Panel) with 3d model
Post by: ArenMook on September 06, 2012, 06:59:16 AM
Well, I can suggest you start by looking into the NGUI's clipped shaders. If you don't know shaders, then I'm guessing by "help with the shader" you mean "make me a shader"? I would do it if I wasn't this crazy busy :|
Title: Re: Scroll view (Panel) with 3d model
Post by: joreldraw on September 27, 2012, 02:06:41 AM
Im trying now the Example 8 scene to make a dragable 3d content.
I open the scene and i only add a 3d element to the existing list item
The 3d model is render fine but the Dragcamera autoset limits with the 2d objects, and not use the 3d to calculate the end of the bounds
Title: Re: Scroll view (Panel) with 3d model
Post by: ArenMook on September 27, 2012, 07:36:34 AM
That's because 3D is not a widget, and only widgets are considered. Add an outline background widget.
Title: Re: Scroll view (Panel) with 3d model
Post by: joreldraw on September 27, 2012, 09:00:40 AM
Solved!! Thanks
Title: Re: Scroll view (Panel) with 3d model
Post by: yuewah on September 28, 2012, 05:01:59 AM
@joreldraw, how do you solve the problem ?
Title: Re: Scroll view (Panel) with 3d model
Post by: joreldraw on October 03, 2012, 04:48:07 AM
That's because 3D is not a widget, and only widgets are considered. Add an outline background widget.
I add a widget with alpha to 0 with similar dimensions of my 3d object and now make the bounding box of this. Is a fake solution but work
Title: Re: Scroll view (Panel) with 3d model
Post by: Nicki on October 03, 2012, 05:28:18 AM
Clipping 3d models can also be done by having a separate camera with a smaller view rect that fits your scroll.
Title: Re: Scroll view (Panel) with 3d model
Post by: joreldraw on October 03, 2012, 05:49:58 AM
Right, this was my problem, that i generate the 3d models in realtime depending of a database list. Rect is not the same evertime. For this reason i add to my 3d model prefab a widget with her rect dimension, and the drag rect is recalculate when i add objects.
Title: Re: Scroll view (Panel) with 3d model
Post by: yuewah on October 04, 2012, 08:44:45 AM
although having a 2D widget can fake it to work for scrolling, the clipping is not work for the 3D model.
Title: Re: Scroll view (Panel) with 3d model
Post by: ArenMook on October 04, 2012, 10:40:01 AM
Clipping is done via a shader, so unless the shader used on the 3D model has code that lets it use clipping, there won't be any.
Title: Re: Scroll view (Panel) with 3d model
Post by: ArvoAnimi on January 07, 2014, 01:08:40 PM
Edit: could make some changes to the layout to make it work with the draggable camera so screw it XD... Thanks anyway!
I'm sorry about reviving the poster's question, but I'm in need of making a spine2d object (a bunch of animated sprites but still would be a 3d obj for ngui) work with panel clipping, and haven't been able to do it, need a vector to point to and if possible Help from pro users ( ArenMook is updating this thing like crazy so it's understandable if he doesn't have the time ). Note that I said help, do not want people to do stuff for me, I've just tried and looked for an answer for some time and have come to accept it's beyond me atm. Need direction.
Title: Re: Scroll view (Panel) with 3d model
Post by: 3dmodelfarm on September 26, 2014, 12:54:37 AM
Is this issue fixed ? If yes then please share some suggestions regarding the issue i am not able to get anything from those comments.
Title: Re: Scroll view (Panel) with 3d model
Post by: ArenMook on September 27, 2014, 06:06:44 PM
What issue? 3D models are not a part of the UI, so they won't get clipped. You want them clipped, you need to write a custom shader or draw them to a render texture.
Title: Re: Scroll view (Panel) with 3d model
Post by: Wisteso on September 28, 2014, 05:44:12 PM
There's a post somewhere in this forum where another (very kind) user posted their code. It did not work 100% for me until I resolved a general issue with it. I posted that amendment to the same thread. If you search my history you'll see it.
Though it's not a bug. NGUI does not support 3D components, you're on your own if you chose to do it (though it's definitely doable).