User Submitted Code Samples - Page 3

Stencil Shadow Volume Using Z-Fail (OpenGL - C++)
 

Author: ViLiO

This sample demonstrates how to create real-time shadows under OpenGL using shadow volumes. It demonstrates the basics which are required to create a shadow volume including how to use the Z-Fail technique to render correct shadows when the viewing position is inside the shadow volume. This technique is also know as Carmacks' Reverse.

This sample is based on older sample which can be found here.

Relevant C++ Keywords: glDepthMask, glStencilFunc, glStencilOp, glColorMask, glPolygonMode, glCullFace, GL_CULL_FACE, GL_STENCIL_TEST, GL_FALSE, GL_TRUE, GL_ALWAYS, GL_KEEP, GL_BACK, GL_FRONT, GL_EQUAL, GL_LESS, GL_LINE, GL_FILL, and GL_STENCIL_BUFFER_BIT.

 

Progressive Meshes (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to create and manipulate the level-of-detail of a progressive mesh object.

Relevant Keywords:ProgressiveMesh, MeshFlags.SimplifyFace, Mesh.FromFile, ExtendedMaterial, TextureLoader.FromFile, NumberFaces, MaxFaces, and TextureFilename.

 

Simple Pixel Shaders (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to create simple assembly language based pixel shaders.

Relevant Keywords: PixelShader, GraphicsStream, ShaderLoader.FromFile, ps.1.0, mov, texcoord, dp3, mul, tex, t0, t1, r0, r1, v0, mov_x2, and lrp.

 

Cell Shading (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to apply a popular non-photorealistic rendering technique called cell shading.

Relevant Keywords: ShaderLoader.FromFile, VertexShader, PixelShader, GraphicsStream, SamplerState, SetTexture, TextureState, vs.1.0, mov, dp3, mul, tex, t0, t1, r0, r1, v0, m4x4, oPos, sub, rsq, dcl_position, dcl_normal, and dcl_texcoord.

 

Loading Effect Files (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to load a .fx file, which defines a shader and the state settings required to render a simulated wood grain on a piece of geometry.

Relevant Keywords: Effect, EffectHandle, EffectPool, GetParameter, GetTechnique, SetValue, FX.DoNotSaveShaderState, Begin, BeginPass, End, EndPass, float4x4, float, float3, float4, texture, sampler3D, sampler_state, Texture, MinFilter, MagFilter, Linear, MipFilter, None, POSITION, NORMAL, TEXCOORD0, TEXCOORD1, TEXCOORD2, TEXCOORD3, TEXCOORD4, TEXCOORD5, TEXCOORD6, TEXCOORD7, mul, normalize, tex3d, floor, lerp, smoothstep, and dot.