topical media & game development
shader-scene-product.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
</a></p>
example(s) -- camera / shader
DEF WorldInfo WorldInfo {
title "Scene Rendering wit postprocess shader"
info [
"(c) 2006 Holger Grahn - hg @ snafu.de"
"some Shader ideas from ATI RenderMonkey ScreenSpace Effects"
]
}
DEF RESOURCES Switch {
whichChoice -1
choice [
]
}
Background { skyColor [ 0.2 0.2 0.2 ] }
NavigationInfo {
headlight FALSE speed 1.0
type [ "WALK" "ANY" ]
}
Background { skyColor [ 0 0 0 ] }
DEF VIEWPOINT Viewpoint
{
position 0 0 1.0
##orientation 0 1 0 0.0405898
##fieldOfView 0.95993
}
render
DEF GROUP_RENDER GroupRenderToTexture {
children
# the scene to render
## DEF SCENE Inline { url "@vr-shader-camera.wrl" }
##DEF SCENE Inline { url "@vr-x-ball-9.wrl" }
##DEF SCENE Inline { url "@vr-web3d-box.wrl" }
DEF SCENE Inline { url "@vr-object-dam.wrl" }
# scene is rendered to this texture
outputTexture DEF OUTPUT_TEXTURE CompositeTexture3D
{
pixelWidth 512
pixelHeight 512
}
shader
# render the output image by using OUTPUT_TEXTURE
outputChildren
Shape {
appearance DEF ShaderAppearance ShaderAppearance {
transparent FALSE
vertexShader DEF VertexShader VertexShader
{
url "hlsl:
float4x4 modelViewProjectionT;
struct VS_OUTPUT
{
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
};
VS_OUTPUT main (
float4 Pos : POSITION,
float3 Norm : NORMAL,
float2 Tex : TEXCOORD0
)
{
VS_OUTPUT Out = (VS_OUTPUT)0;
Out.Pos = mul(Pos,modelViewProjectionT); // position (projected)
//Out.Tex = Tex;
Out.Tex = float2(Tex.x,1.0f-Tex.y); // Y FLIP
return Out;
}
"
}
fragmentShader
DEF FragmentShader FragmentShader
{
exposedField SFFloat time 1
field SFNode image USE OUTPUT_TEXTURE
url [
"local/shader/outline.phl"
]
}
}
geometry
Rectangle { }
# Box { size 2 2 2 }
}
}
DEF _TimeSensor TimeSensor {
cycleInterval 1
loop TRUE
startTime 0
}
ROUTE _TimeSensor.fraction_changed TO FragmentShader.time
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.