The forum on this site is closed for new comments and posts. Continue the conversation in our Snap AR Discord server.

Reading Shader Color

  • Hi, @...!

    Looks like your material doesn't have a baseColor property.

    Did you create a Node Graph material? Can you check the scripting name of your Color Parameter? 

    If this is the issue you can either change scripting name to baseColor  or access it via: 

    //@input Asset.Material mat
    print(script.mat.mainPass["Tweak_N0"])

    Hope this works!

    Best

    Olha

    Comment actions Permalink
  • Thanks Olha.

    It looks like the base colour isn’t set when the script runs on initialized. I placed the script on a tap event and it’s returning a ver4 value. But the value seems to be the same no matter what colour I set it.

    Is it not possible to access the updated color from the shader?

    Comment actions Permalink
  • Hi, @...

    Could you please take a look at this project? Everything seems to work for me. Here is my set-up and code

    Best

    Olha

     

     

    Comment actions Permalink
  • Please activate my snapchat profile so people can see my lenses and subscribe my page.

    Comment actions Permalink
  • Thanks Olha for the reply. I see you are using a "Color Parameter" node, I want to read the color from the Shader when its been assigned by something else like a "Color Value" node.

    Comment actions Permalink
  • Sorry I don't quite understand what are you trying to achieve. Maybe you could provide some context? Value nodes are designed to return predefined value, you can't assign or access them from the script.

    If you want to access a result color of a shader you can render it and then access a pixel color of a Render Target texture using getPixels() method of a ProceduraltextureProvider. Is it something that you might use? example

    Let me know

    Best

    Olha

     

    Comment actions Permalink
  • Actually that's all the bits I need to get it going.

    Many thanks Olha :D

    K.

     

    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?

Version

Graphics

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:

Name:

Email:

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!