Shader uniform Vec4 from script

panicqpanicq Posts: 67Member

Hey, I'm trying to do something that sounds really easy:
**Setting a vec4 uniform from script **


You can easily reproduce the issue by creating a vec4, using SetShaderParam you set the 4 values to a value such as 15 (using the Color struct). You add a 2D sampler for a look up texture (each line a different color), and you try to sample using UV where X = 0 and Y = one of the value of the vec4 (r,g,b and a divided by the height of your texture), you'll see that you will have an issue in build but not in editor. Probably a precision error ?

I first though Color was clamping my value, so I tried dividing my value directly in my script...this is still not working.
Note that sending a float, Vector2 or Vector3 works fine.

Any idea is more than welcome !

Comments

  • panicqpanicq Posts: 67Member
    edited July 6

    After talking on discord with a member, it seems that HDR colors components are set to 0 when doing linear color conversion, and we can't bypass the linear color conversion, so we cannot send a Color. I forgot the existence of Rect2 (position as xy and size as zw) , and they are working fine in my case, no conversion !

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file