boltut Posted November 26, 2022 Share Posted November 26, 2022 (edited) SDK version: 2.10.0.2 I try to use code from this article: https://developer.unigine.com/ru/docs/2.10/code/uusl/create_post?rlang=cpp Shader console output from editor: Quote Shaders compile: 0 (0s) Render::getMaterial(): can't find "custo" material Failed to compile fragment shader: shaders/fragment/post.frag Compilation log: 0(3273) : error C1503: undefined variable "FLOAT3" glsl 3273: vec3 gray_scene_color = FLOAT3(dot(vec3(0.3, 0.59, 0.11), scene_color.rgb)); 0(3274) : error C1503: undefined variable "FLOAT3" glsl 3274: scene_color.rgb = mix(scene_color.rgb, gray_scene_color, FLOAT3(grayscale_power)); Material::create_shader(): can't compile pass:"post" material:"custom_post" I change FLOAT3 to float3, but it doesn't help. Error disappears, but shader still don't work. What should I do to use code from this tutorial? Also, where can I see working samples with post-processing shaders for sdk 2.10.0.2? My final goal - adapt material "compass_mat.basement" from demo "mars" from sdk version 2.16 to using in project with sdk version 2.10.0.2 Thanks! Edited November 26, 2022 by boltut Link to comment
fox Posted November 28, 2022 Share Posted November 28, 2022 Hi, boltut! Seems like code snippets in this article had a couple of problems during the migration process. To make this example work simply make the following changes: In the custom_post material source code Replace this line: <parameter name="grayscale_power" type="slider" shared="1" min="0.0" max="1.0" flags="max_expand">0.5</parameter> With this one: <slider name="grayscale_power" shared="1" min="0.0" max="1.0" flags="max_expand">0.5</slider> In the post.frag fragment shader code Replace these lines: float3 gray_scene_color = FLOAT3(dot(float3(0.3f, 0.59f, 0.11f), scene_color.rgb)); scene_color.rgb = lerp(scene_color.rgb,gray_scene_color,FLOAT3(grayscale_power)); With the following ones: float3 gray_scene_color = dot(float3(0.3f, 0.59f, 0.11f), scene_color.rgb); scene_color.rgb = lerp(scene_color.rgb,gray_scene_color,grayscale_power); This should make the sample work. We've also fixed these samples in the Docs, the updated versions are available in Docs 2.10, We're sorry for the inconvenience caused. Hope this helps. Link to comment
boltut Posted November 28, 2022 Author Share Posted November 28, 2022 Thanks, I will try! Link to comment
Recommended Posts