/ Published in: Other
**Important: this snipplet has moved to Github.**
- [Three ways to embed an HLSL shader in VRML/X3D](https://gist.github.com/1972985)
- [Three ways to embed an HLSL shader in VRML/X3D](https://gist.github.com/1972985)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
## FragmentShader Transform { translation -4 2 0 children Shape { appearance Appearance{material Material{diffuseColor 0 0 0 emissiveColor 1 1 1}} geometry Text{ string "FragmentShader (inline)" fontStyle FontStyle{justify "MIDDLE" family "Arial" size 0.3} } } } Transform { translation -4 0 0 children Shape { appearance ShaderAppearance { textureTransform DEF textureTransform TextureTransform {scale 5 5} fragmentShader FragmentShader { exposedField SFNode png DEF png ImageTexture {url "example.png"} url "hlsl: sampler2D png: register(s0); float4 main( float2 tex0: TEXCOORD0 ): COLOR { return tex2D(png, tex0); } " } } geometry DEF geometry Box{} } } ## VertexShader Transform { translation 0 2 0 children Shape { appearance Appearance{material Material{diffuseColor 0 0 0 emissiveColor 1 1 1}} geometry Text{ string "VertexShader (.fx)" fontStyle FontStyle{justify "MIDDLE" family "Arial" size 0.3} } } } Transform { translation 0 0 0 children Shape { appearance ShaderAppearance { textureTransform USE textureTransform vertexShader VertexShader { exposedField SFNode png USE png url "example.fx" } } geometry USE geometry } } ## PackagedShader Transform { translation 4 2 0 children Shape { appearance Appearance{material Material{diffuseColor 0 0 0 emissiveColor 1 1 1}} geometry Text{ string "PackagedShader (.fx)" fontStyle FontStyle{justify "MIDDLE" family "Arial" size 0.3} } } } Transform { translation 4 0 0 children Shape { appearance Appearance { textureTransform USE textureTransform shaders PackagedShader { language "HLSL" exposedField SFNode png USE png url "example.fx" } } geometry USE geometry } }