Graphics

 View Only
  • 1.  Planar Texture mapping

    Posted 09-25-2019 15:00

    Hi.

    Is there a way to map an image on a slab and keep its position and size regardless of the objects size?

    I want a lower third with autoscaled background but the image should not scale.

    In the material options i can only see default an spherical texture mapping. But i would need a planar/frontal mapping.

    Any suggestions?



  • 2.  RE: Planar Texture mapping

    Posted 09-25-2019 21:10

    Hello Bernhard

    Try this :
    - put your slab and text in a group
    - Set the X-pivot=0 in "texture coords" tab info of you slab
    - in visual logic : set Slab.textureCoords.Scale.X to be the ratio of slab's width / material image's width :

    now the mapped image should follow your slab without distortion.

    if you want the slab to stay always at the same X position when width is changed add this visual logic :


    Then add a logic to auto size the slab width from the text size.

    Here is full visual logic :

    (here the Text1.position.x is an offset from his parent group to add some space for the text in the slab)


    Here is the result :

    Hope it helps,

    Antoine.


    #XPression


  • 3.  RE: Planar Texture mapping

    Posted 09-26-2019 07:26

    Thanks for the nice workaround. I already thought of doing it with visual logic or maybe with masking.

    But actually, I thought I was missing something. Because different mapping types should be a basic function when working in 3D *waving at the Dev-Team* ;-)

     


    #XPression


  • 4.  RE: Planar Texture mapping

    Posted 09-29-2019 04:13

    Can I add a twist? How would you do the same thing but with the bar and text right justified? I'll take my answer off the air. Thanks in advance.


    #XPression


  • 5.  RE: Planar Texture mapping

    Posted 09-29-2019 09:59

    Hello Malcolm,

    here is a new visual logic :

    ( absolute block has been added, slab.position.x is slab.width divide by -2 instead of 2 )

    - set the text to "right alignement"

    - change text offset (text.position.X) to be a negative value.

    - if the texture has to grow from the right too : change the X-pivot=1 in "texture coords" tab info of the slab

    the result looks like this :

     

    Antoine.


    #XPression


  • 6.  RE: Planar Texture mapping

    Posted 09-29-2019 17:09

    Thank you very much Mignon

    This solves a roadblock for me. 


    #XPression


  • 7.  RE: Planar Texture mapping

    Posted 09-30-2019 17:56

    Antoine,

    I misspoke. Ultimately here is what I want to do. Right justified text width(bounding box) controls the x position of my bg. As the text gets longer, the position of x of bg decreases to make room for a longer name. Once this position is set, the entire group will animate on from the right side of the screen using x pos. Thank you in advance.

     

    And please forgive me for getting your name wrong.


    #XPression


  • 8.  RE: Planar Texture mapping

    Posted 10-15-2019 23:19

    Hey Malcolm,

    As you don't know in advance how big your bg will be, I think the best way would be to use a dummy-value.

    To clarify, I often use dummy-values to animate a bar to a certain height where I don't know how high it has to be. So I use a known value of a dummy quad and I multiply that with a dynamic value to generate a dynamic animation.

     

    It sounds abstract but there's how it works:

    • create a quad which you set invisible or where you don't assign a material to it.

    • create an animation controller where you animate the X-scale from 0 to 1

    • create a logic where you multiply the X-scale of the dummy-quad with the boundingbox of the bg. So when the value of the X-scale is 0 (0*1000 = 0) and when it's 1 (1*1000 = 1000) which you can then add or subtract from the position where your group is supposed to end.

    You would also have to take into account an offset ofcourse. If your group is placed at 100px of the edge of the scene, you would probably add 100px or a bit more offset to make sure the group is out of the image.

    This way when you play the dummy-animation (which scales from 0 to 1) the Visual Logic animates your group in.

    If you wanted to add some interpolation, you can do that by adding the interpolation on the dummy animation.

     

    Best regards,

    Kenneth


    #XPression