Return to Snippet

Revision: 33809
at October 13, 2010 19:29 by wildpeaks


Initial Code
## 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
	}
}

Initial URL
http://www.wildpeaks.com

Initial Description
**Important: this snipplet has moved to Github.**

 - [Three ways to embed an HLSL shader in VRML/X3D](https://gist.github.com/1972985)

Initial Title
VRML: 3 ways to embed an HLSL shader

Initial Tags

                                

Initial Language
Other