The forum on this site is closed for new comments and posts. Continue the conversation in the new forum, and learn more here.

Moving texture coordinates, not just scale

  • Hi Alfred,

    You can do this through the Material drawing the texture instead of going through the Face Texture itself.

    First, make sure your Face Texture's Scale is set to (1,1), since we're going to scale it through the Material instead.

    Next, create a new Material for drawing the texture (if you don't have one already). If you're drawing it as a Sprite, use Add New > Material > Component Defaults > Sprite. In whatever component is drawing the texture (Mesh Visual, Sprite, etc), make sure "Material" is set to this Material.

    Now, select the Material. In Base Texture, set "Texture" to your Face Texture, and set "Texture UV" to "Transformed UV 2". Enable the "UV 2" section and set "Source" to "Mesh UV 0". Here you can modify scale like you normally would in Face Texture, and also modify the offset. It should look something like this:

    To access these properties in script, use something like:

    //@input Asset.Material material

    // Set the scale
    script.material.mainPass.uv2Scale = new vec2(0.2, 0.1);

    // Set the offset
    script.material.mainPass.uv2Offset = new vec2(0.4, 0.45);

    Let me know if you have any more questions! And I'm very curious to see what you make with this :)



    Comment actions Permalink
  • Jacob,

    Ah cool! I didn't realize that I could do this within the material.

    Though, as soon as I've changed the "Texture UV" to "Transformed UV 2" and turn on "UV 2", the texture map completely disappears. I've tried offsetting/scaling and trying solid textures to test if the texture shows up, but nothing seems to work--I just get the default gray color of the mesh I'm trying to map onto.

    Any ideas what I can test to see what's boogered?


    Comment actions Permalink
  • Hi Alfred,

    I'm not sure what's wrong, can you give some details about the material you're using? Can you maybe take a screenshot of the material settings?


    Comment actions Permalink
  • Jacob,

    There isn't anything special in the material. I'll attach a reproduction steps along with a screen cap of what I'm seeing


    To reproduce:

    1. Create a sphere (+ Add New > Sphere)

    2. Create a Material and assign the Mesh Visual in the Sphere to this material.

    3. Create a Face Texture and assign that to the Material's Base Texture

    4. Set the Texture UV in the Material to "Transformed UV 2"

    5. Optional: Check on "UV 2" n the Material


    By the end of step 4, you should see that the sphere has the default gray material.


    Comment actions Permalink
  • Hi Alfred, 

    Try changing "Offset" to (0, 0) instead of the default (1, 1), since the offset is pushing the texture all the way to the side. Since the texture wrap mode is set to Clamp (by default), it's clamping the drawn pixels at position 1.0 which is the very edge of the texture. Hope this helps!

    Comment actions Permalink
  • That does. Thank you. I'm ashamed I didn't see this before.


    My request would be to have default offsets set to 0.


    Thank you!

    Comment actions Permalink
  • Sorry for the confusion! I agree that 0 is a much better default value, thanks for bringing it up. I'll contact the engineering team to add it to our list of feature requests.


    Comment actions Permalink

We're here to help! We just need a little bit of information...

What system are you using?

Have you downloaded the latest version of Lens Studio?

Please download the latest version of Lens Studio. If you still run into this issue, please come back and report it!

Is this issue causing Lens Studio to crash?

What system do you run Lens Studio on?



Follow the next steps to help us solve your issue:

  • Copy and paste this text into your TerminalCommand Window
    open ~/Library/Preferences/Snap/Lens\ Studio/ %LOCALAPPDATA%\Snap\Lens Studio Copy Text
  • Press ReturnEnter to run the command. The Lens Studio folder will automatically open
  • Prepare to upload your files: zip the "Log" Folder by right-clicking and choosing "compress."
    Locate the Log.txt file right above it.

    Attach a screenshot of the issue:



What is this most relevant to?

Please enter a brief description of your issue:

Thanks for submitting this issue.

Unfortunately, it's likely due to the operating system or hardware you're using – since they don't meet the system requirements for Lens Studio.

Still, we hear you loud and clear, and are logging the issue in case there's ever a workaround we can provide!

Minimum Requirements

Operating System: Windows 10 (64 bit); MacOS 10.11+

Hardware: Minimum of Intel Core i3 2.5Ghz or AMD Phenom II 2.6Ghz with 4 GB RAM; Intel HD Graphics 4000 / Nvidia GeForce 710 / AMD Radeon HD 6450 or better; screen resolution of 1280x768 or higher

We'll try to resolve this issue as soon as possible. Thanks for letting us know about it!

Keep an eye out for a followup email from us. We may have a couple more questions for you, or we might already have a solution to offer.

Happy creating!