Pink water
Whenever I place water in the terrain it becomes this pink texture. Is there a way to fix that? I just started using Unity Yesterday (free version)
FYI - Better to not put this as an Answer, but as a comment.
I have these three errors;
Severity Code Description Project Project Rank File Line Column Category Source Suppression State Tool Error Shader error in 'FX/Water': undeclared identifier 'unity_Object2World' at line 80 (on d3d11)
Compiling Vertex program with WATER_REFRACTIVE Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING Solution 'sch2' (2 projects) 3 0 0 IntelliSense
Severity Code Description Project Project Rank File Line Column Category Source Suppression State Tool Error Shader error in 'FX/SimpleWater4': undeclared identifier 'unity_ObjectToWorld' at line 130 (on d3d11)
Compiling Vertex program with WATER_REFLECTIVE WATER_VERTEX_DISPLACE$$anonymous$$ENT_ON WATER_EDGEBLEND_ON Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING Solution 'sch2' (2 projects) 3 0 0 IntelliSense
Severity Code Description Project Project Rank File Line Column Category Source Suppression State Tool Error Shader error in 'FX/Water': undeclared identifier 'unity_ObjectToWorld' at line 80 (on d3d11)
Compiling Vertex program with WATER_REFRACTIVE Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING Solution 'sch2' (2 projects) 3 0 0 IntelliSense
I am not a programmer English is not my language Can anyone fix this?
In first error u must delete unity word at line 80 in monodevelop and just leave '_Object2World' In second you must find that shader in monodevelop it will be in water4 folder and replace 'unity_ObjectToWorld' at line 130 to "_Object2World" In third error find that FX/Water open in monodevelop and do like in second error but at line 80 I think that should help but im not a programmer and English is not my first language too.
This worked for me, but there are in fact several lines of code in each water "shaders" file that need to be re-worked. The key is to save after each change and check the console error report again and again. It will list the next line of code with an error until, finally, you have fixed it.
Answer by Marshall1956 · May 25, 2016 at 11:33 PM
I have had the same problem.
I Import the Standard Assets>Environment.
Under Standard Assets>Environment>Water>Water>Prefabs>WaterProDaytime select and drag onto scene. The round water object appears in the scene as a pink circle (mine is (16,1,16) in size).
The WaterProDaytime game object is added. In the Inspector it has components Transform, Water Plane Mesh (Mesh Filter), Mesh Renderer, Water (Script), material WaterProDaytime.
The material WaterProDaytime is pink. It has a Shader FX/Water.
The FX/Water Shader is the problem.
Find the FX/Water Shader in the Assets. It is found in Standard Assets>Environment>Water>Water>Shaders>FXWaterPro. Select this. In the Inspector it has Default Maps, Imported Object FX/Water.
Under Imported Object FX/Water there is Compiled code with a button "Compile and show code". If you click Compile and show code, I get multiple error messages, basically all the same:
'unity_ObjectToWorld' : undeclared identifier opengl 80
undeclared identifier 'unity_ObjectToWorld' d3d9 80
etc.
Double click the FXWaterPro icon in the Project folder you found above. This opens script FXWaterPro.shader in MonoDevelop. The first line of the script is:
1 // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Notice that the error messages relate to '_Object2World'. If you search the code for 'unity_ObjectToWorld' you will find it in only one place:
80 float4 wpos = mul (unity_ObjectToWorld, v.vertex);
Just replace unity_ObjectToWorld with _Object2World:
80 float4 wpos = mul (_Object2World, v.vertex);
Save the script (Ctrl-S). Go back to Unity and now your water is working!
Both WaterProDaytime and WaterProNighttime use the same FX/Water shader.
If someone knows why the Upgrade replaces the text as above, I would like to know. If there are undesirable effects caused by the renaming I would also like to know. I haven't tried to publish any projects, but it works in the editor.
I have Unity Personal (64bit) version 5.3.4f1 Personal
Thanks for help, but i had also problem with FXWaterBasic.shader i just do the same thing like in FXWaterPro.shader in $$anonymous$$onoDevelop.
First line of FXWaterBasic.shader:
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
In line 43 just replace
float4 wpos = mul (unity_ObjectToWorld, v.vertex);
to:
float4 wpos = mul (_Object2World, v.vertex);
I think this resolve problem for these water shaders for now.
you guys are genius!!! thank you so much! I was desperated and you fixed it thanks a lot!!!
@$$anonymous$$gerr and @$$anonymous$$arshall1956
now all of my water prefabs are working perfectly! and my scene is looking great thanks to you... cause water gives just a really great touch!!!
Thank you, this problem was driving me nuts, along with lag problems from DX11. Unity 5 is still seriously bugged all around, and the devs shouldn't even consider it stable right now.
THIS DOES NOT WOR$$anonymous$$. I REPEAT. THIS DOES NOT WOR$$anonymous$$. UNITY, YOU $$anonymous$$UST FIX THIS OR LOSE CUSTO$$anonymous$$ERS!
I tried the suggested solution, but I just get the same error: "Shader error in 'FX/Water': undeclared identifier 'unity_Object2World' at line 80 (on glcore)
Compiling Vertex program with WATER_REFRACTIVE Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DES$$anonymous$$TOP"
Neither "ObjectToWorld" or "Object2World" work! Please help.
Delete unity in monodevelop its must be _Object2World not unity_Object2World it's a difference
Your answer
Follow this Question
Related Questions
Basic Water shader error message 6 Answers
Particles on Water 0 Answers
Cartoon Water shader for endless platform. 0 Answers
Water Asset is missing? Wanting to add a puddle to my scene. 2 Answers