You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_posts/custom-shaders.md
+61-1Lines changed: 61 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ However, you will often want to perform special effects or special cases for you
23
23
24
24
WebGL uses the GLSL language to write shaders that can be run across all browsers. With X_ITE you create your own shader using [ComposedShader](/x_ite/components/shaders/composedshader/) and [ShaderPart](/x_ite/components/shaders/shaderpart/) nodes and than attach the ComposedShader to the *shader* field of an [Appearance](/x_ite/components/shape/appearance/) node and that is a child's play with [Sunrize](/sunrize/).
uniform float set_time; // value from set_time field
114
+
...
115
+
"
116
+
}
117
+
ShaderPart {
118
+
type "FRAGMENT"
119
+
url "data:x-shader/x-fragment,#version 300 es
120
+
// Fragment Shader
121
+
...
122
+
uniform sampler2D x3d_Texture2D [1]; // image from ImageTexture node
123
+
...
124
+
"
125
+
}
126
+
]
127
+
}
128
+
}
129
+
geometry ElevationGrid {
130
+
xDimension 10
131
+
zDimension 10
132
+
}
133
+
}
134
+
}
135
+
136
+
ROUTE Timer.elapsedTime TO Shader.set_time
137
+
```
138
+
79
139
Once the X3D is defined we can now write the vertex and the fragment shader source. This is a simple example where a texture is applied to the geometry.
0 commit comments