4
2016
Shader error: cannot map expression to vertex shader instruction
Had a strange looking error today:
Shader error in 'Custom/WhatAFineShader': cannot map expression to vertex shader instruction set at line 60 (on d3d9)
Turns out it was just that the function which was called inside vertex shader, was below the vertex shader,
so just moved it above the v2f vert (appdata v) and it works..
*Actually it was more complicated:
This one gives error: (maybe because noise is reserved word)
v2f vert (appdata v)
{
v2f o;
float var = noise(float2(0,0));
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex+var);
return o;
}
float noise(float2 xy)
{
return 0;
}
This one doesn’t
float noise(float2 xy)
{
return 0;
}
v2f vert (appdata v)
{
v2f o;
float var = noise(float2(0,0));
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex+var);
return o;
}
Related Posts
Leave a comment
Recent posts
- Testing Unity AI Beta
- Ways to Support UnityCoder Development
- Using UI Slider to Create 5-Star Rating Element
- Game Music Library For Unity (editor plugin)
- Fontastic : Easily Test Fonts in Unity Editor!
- GeoTiff Importer & Terrain Generator for Unity
- Create Baked DropShadow for UI images
- .JP2 Ortho Image Converter to PNG/JPG/TIFF
- Convert LAS/LAZ/PLY pointclouds to GLTF (GLB) Point Meshes (standalone converter)
- Detect SRP (URP or HDRP) with Assembly Definition Version Defines
- [LudumDare57] Theme: Depths
- MotionVector Effect: Object “disappears” when paused
Recent Comments
- on [Asset Store] PolygonCollider2D Optimizer
- on Trajectory Test Scene 2.0
- on Vector3 maths for dummies!
- on UnityHub 3.6.0: Remove Version Control & Cloud Dashboard columns
- on Using RenderDoc with Unity (graphics debugger)
- on UI Scroll View automatic Content height
- on [Asset Store] Point Cloud Viewer & Tools
- on [Asset Store] Point Cloud Viewer & Tools
Coin:
CUgDSbRqFcAumDSAcdKDvuXsw26VdkJe8C8WGUQHBAGS
An article by











