Comments (1)
thank @all-iver
the solution looks like that:
open your shapes.shader file and insert the lines flagged with //Inserted
struct appdata_t {
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID // Inserted
};
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 modelPos : TEXCOORD1;
fixed4 color : COLOR;
UNITY_VERTEX_OUTPUT_STEREO // Inserted
};
v2f vert(appdata_t v) {
v2f o;
UNITY_SETUP_INSTANCE_ID(v); // Inserted
UNITY_INITIALIZE_OUTPUT(v2f, o); // Inserted
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); // Inserted
o.pos = UnityObjectToClipPos(v.vertex);
// translate input uv coords (which are from 0 - 1 on either dimension) to something more
// useful (-0.5 to 0.5).
o.uv = v.texcoord.xy - 0.5;
o.modelPos = v.vertex;
// hijack modelPos.z to be distance from camera plane since it
// isn't being used for anything else. used for pixel size.
o.modelPos.z = -UnityObjectToViewPos(v.vertex).z;
// for Unity versions < 5.4.0f3
// o.modelPos.z = -mul(UNITY_MATRIX_MV, v.vertex).z;
o.color = v.color;
return o;
}
from shapes2d.
Related Issues (20)
- Allow setting bake-to-PNG resolution for UI shapes (currently only works for sprite shapes)
- Option to fit-inside-rect when creating a shape from a PolygonCollider2D
- Can we move more shader code into the vert shader?
- Polygon shape doesn't work on iPad?
- Polygon optimization no longer seems to work HOT 1
- Convert to sprite doesn't work while editing a prefab HOT 1
- Incorrect scale of outlines and roundness, etc, when editing prefab in some cases HOT 2
- Convert to sprite may not work in universal render pipeline
- SetPathWorldSegments() doesn't work properly after Instantiate() and before Start()
- bugs when rendering shapes on Screen Space Canvas (HDRP) HOT 1
- Build for Apple Silicon does not render correctly HOT 1
- Fill color not set corectly with URP HOT 2
- Documentation is down HOT 2
- Polygon/path editing does not always work for UI shapes in ScreenSpace - Camera
- Add Shape to Image -> Invisible HOT 6
- Shapes don't observe SpriteMask
- Possible issues with Samsung Galaxy S9/S10
- Prefab icon renders incorrectly
- Gradient Changes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shapes2d.