Author Topic: Scroll view (Panel) with 3d model  (Read 15002 times)

iceiceice

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Scroll view (Panel) with 3d model
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll view (Panel) with 3d model
« Reply #1 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.

joreldraw

  • Guest
Re: Scroll view (Panel) with 3d model
« Reply #2 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.


yuewah

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 180
    • View Profile
Re: Scroll view (Panel) with 3d model
« Reply #3 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.

joreldraw

  • Guest
Re: Scroll view (Panel) with 3d model
« Reply #4 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

But how i can set this cutt area to an only one areabox similar to clippingPanel effective area?

joreldraw

  • Guest
Re: Scroll view (Panel) with 3d model
« Reply #5 on: September 06, 2012, 04:49:05 AM »
Nobody can help me with the shader?
 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll view (Panel) with 3d model
« Reply #6 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 :|

joreldraw

  • Guest
Re: Scroll view (Panel) with 3d model
« Reply #7 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll view (Panel) with 3d model
« Reply #8 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.

joreldraw

  • Guest
Re: Scroll view (Panel) with 3d model
« Reply #9 on: September 27, 2012, 09:00:40 AM »
Solved!! Thanks

yuewah

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 180
    • View Profile
Re: Scroll view (Panel) with 3d model
« Reply #10 on: September 28, 2012, 05:01:59 AM »
@joreldraw, how do you solve the problem ?

joreldraw

  • Guest
Re: Scroll view (Panel) with 3d model
« Reply #11 on: October 03, 2012, 04:48:07 AM »
  1. 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

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Scroll view (Panel) with 3d model
« Reply #12 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.

joreldraw

  • Guest
Re: Scroll view (Panel) with 3d model
« Reply #13 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.

yuewah

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 180
    • View Profile
Re: Scroll view (Panel) with 3d model
« Reply #14 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.