SA09 Realtime education

Download SA09 Realtime education

Post on 13-Jan-2015

627 views

Category:

Technology

1 download

Embed Size (px)

DESCRIPTION

 

TRANSCRIPT

<ul><li> 1. Try Real-time Shader for artist.Claim back Shader to Softimage artist.CSR&amp;D Support Dept.Artist Fumoto Kazuhiro</li></ul> <p> 2. Summary Self-introduction The Advantage to the artist The Realtime-Shader to perform on Softimage Hurdles on learning Shader Shading NormalMap, EnvironmentMap Calculation for expression GoalResult (to Cgfx) 3. Self-introduction About CS R&amp;D Support Dept. Graphic library development, Developmentalenvironment, Investigation and experiment of the nextgeneration graphic About me Real-time graphic development. In-house tool (such as plug-in) development andsupport (mainly Softimage) for the artist. Technical artist. 4. An advantage to the artist. The adjustment of the Shader parameter is easy. WYSIWYG - You can see Game Graphics through datamaking. You can get clear knowledge about shader.Express higher graphic by learning about the shaderIt doesnt matter if you cant write shader code 5. Face Shader Demo About Fake image based lighting, Fake sub surfacescattering 6. Simple IBL There are three hurdles to express this Shader. 7. Hurdle1 Dot (Inner) product 8. Hurdle1 Shading works out with the dot product of the normalvector and the light vector. The expressionNL = cos Shading : cos Normar Vector : N Light Vector : L 9. Hurdle1 For exampleThe angle of the Normal Vector and the Light Vector is60 degrees.Brightness is 0.5. 10. Hurdle1 In Cg Shaderfloat dif1 = dot(normal, light); The dot() calculates the dot-product which is based onthe data in the parentheses. The data in the parenthesis are Normal Vectors and LightVectors. This expression says that the result which is calculatedby dot() is put in the variable is called dif1, and declaresfloat (few floating mark). 11. Hurdle1struct v2f {float4 hpos : HPOS;float4 color : COL0; }; v2f main ( Softimage samples. float4 float4pos : POSITION,nrml : NORMAL, uniform float4x4 simodelviewproj, uniform float4x4 simodelviewIT, uniform float4x4 simodelview, uniform float3 silightdirection_0 ) { v2f OUT; OUT.hpos = mul(simodelviewproj, pos); float3 normal = normalize(mul(simodelviewIT, nrml).xyz); float3 lDir1 = normalize(silightdirection_0); float dif1 = dot(normal, lDir1);if(dif1 &lt; 0) dif1 = 0;float4 lColor1 = dif1; OUT.color = lColor1; return OUT; } 12. Hurdle1 { Softimage samples. v2f OUT; OUT.hpos = mul(simodelviewproj, pos); float3 normal = normalize(mul(simodelviewIT, nrml).xyz); float3 lDir1 = normalize(silightdirection_0); float dif1 = dot(normal, lDir1);if(dif1 &lt; 0) dif1 = 0;float4 lColor1 = dif1; OUT.color = lColor1; return OUT; } 13. Hurdle1 Necessary matterThe dot() from two vector data is used to makeShading. 14. Hurdle1 Other examples Relations of Vertex Shader and Fragment Shader Specular Blinn-Phong which uses the half vector. Phong which uses the reflection vector. Dot product applied use Using Eyes Vector in substitution for a light vector. 15. Hurdle2 Normal Map1. Object space2. Tangent space Environment map 16. Hurdle2 Normal map. 17. Hurdle2 Object space normal map.The Object Space Normal Map directly uses RGBbrightness of texture as XYZ of Normal data. Actually, ( NormalTex 0.5 ) 2. 18. Hurdle2 Tangent space normal map. Need to obtain the Normal vector, Tangent vector, Binormal vector. The value of the texture used as a normal data based on that data. 19. Hurdle2 The kinds of Environment maps.1. Simple Environment mapping (sphere)2. Dual-Paraboloid mapping3. Cube mapping 20. Hurdle2 Dual-Paraboloid Environment mappingUses two environment textures, each with a parabolicbasis (requires two texture images). 21. Hurdle1 In Cg Shadersif (R.z &lt; 0)Front { tc0.x = ( -(R.x / (2 * (1 - R.z))) + 0.5) * 0.5; tc0.y = R.y / (2 * (1 - R.z)) + 0.5;} else if (R.z &gt;= 0)Back{ tc0.x = (R.x / (2 * (1 + R.z)) + 0.5) * 0.5 + 0.5; tc0.y = R.y / (2 * (1 + R.z)) + 0.5;} RRefrectVector Tc0.xU to UV Tc0.yV to UV 22. Hurdle3 Shader blending Calculation technique to the result Blurring 23. Hurdle3 Calculation technique to the resultAdd (+), Subtract (-), Mutiply (*), Divide (/)Color data such as texture or shading which is for thefinal graphic.Shading Texture +Flesnel (fake) Environmentmap 24. Hurdle3 Image Based Lighting (Fake) 25. Hurdle3 Blurring of Texture. Program used for blurring a shadow map. Environmental map calculated as Specular + Environmental map calculated as Diffuse = Image Based Lighting (Fake) 26. Hurdle3float4 get_softtex(sampler2D map, float2 loc, int siz){ float x,y;Blur product.float4 sum = 0; int scl; float n, v;Expert fromfloat2 uv, texmapscale; scl = 4;GPU Gems v = 1.5f*scl; n = 4.0f*scl; texmapscale.x = 1.0f/512.0 * siz; set a parameter texmapscale.y = 1.0f/512.0 * siz;for( y=-v ; y</p>