编辑: f19970615123fa 2017-09-01
Interactive?ray?tracing?with? the?NVIDIA?OptiX? engine Steven?Parker,?OptiX?development?mananger SIGGRAPH?2009?presentation SIGGRAPH?2009?presentation OptiX?ray?tracing?engine OVERVIEW SIGGRAPH?2009?presentation OptiX?ray?tracing?engine?\ Overview A?General?Purpose?Ray?Tracing?API Rendering,?baking,?collision?detection,?A.

I.?queries,?etc. Modern?shader\centric,?stateless?and?bindless design Is?not?a?renderer?but?can?implement?many?types?of?renderers Highly?Programmable Shading?with?arbitrary?ray?payloads Ray?generation/framebuffer operations?(cameras,?data?unpacking,?etc.) Programmable?intersection?(triangles,?NURBS,?implicit?surfaces,?etc.) Easy?to?Program Write?single?ray?code?(no?exposed?ray?packets) No?need?to?rewrite?shaders?to?target?different?hardware SIGGRAPH?2009?presentation Programmable?Operations Rasterization Fragment Vertex Geometry Ray?Tracing Closest?Hit Any?Hit Intersection Selector Ray?Generation Miss Exception The ensemble of programs defines the rendering algorithm (or collision detection algorithm, or sound propagation algorithm, etc.) SIGGRAPH?2009?presentation Closest?Hit?Programs:?called?once?after?traversal??has? found?the?closest?intersection Used?for?traditional?surface?shading Deferred?shading Any?Hit?Programs:?called?during?traversal?for?each? potentially?closest?intersection Transparency?without?traversal?restart?(can?read?textures):? rtIgnoreIntersection() Terminate?shadow?rays?that?encounter?opaque?objects:? rtTerminateRay() Both?can?be?used?for?shading?by?modifying?per?ray?state SIGGRAPH?2009?presentation Today'

s?example?C Whitted style?ray?tracing SIGGRAPH?2009?presentation Shading?in?OptiX Interconnection?of?shaders?defines?the?outcome Whitted ray?tracing,?cook,?path?tracing,?photon?mapping Or?collision?detection,?sound?propagation,?… Shading? language is?based?on?C/C++?for?CUDA No?new?language?to?learn Powerful?language?features?available?immediately Pointers Templates Overloading Default?arguments Classes?(no?virtual?functions) Adds?a?powerful?object?model?designed?for?ray?tracing Caveat:?still?need?to?use?responsibly?for?performance SIGGRAPH?2009?presentation Anatomy?of?a?shader includes declarations variables - shader state (read only) textures C 1,2,3D (read only) buffers C 1,2,3D (read/write) shader programs multiple allowed SIGGRAPH?2009?presentation Closest?hit?program?(shader) Defines?what?happens?when?a?ray?hits?an?object Executed?for?nearest?intersection?(closest?hit)?along?a?ray Automatically?performs?deferred?shading Can?recursively?shoot?more?rays Shadows Reflections Ambient?occlusion Most?common SIGGRAPH?2009?presentation Normal?shader?\ goal SIGGRAPH?2009?presentation struct PerRayData_radiance { float3 result;

};

rtDeclareRayData(PerRayData_radiance, prd_radiance);

rtDeclareAttribute(float3, shading_normal);

RT_PROGRAM void closest_hit_radiance() { PerRayData_radiance&

prd = prd_radiance.reference();

float3 worldnormal = normalize(rtTransformNormal(RT_OBJECT_TO_WORLD, shading_normal));

prd.result = worldnormal * 0.5f + 0.5f;

} SIGGRAPH?2009?presentation Normal?shader?\ result SIGGRAPH?2009?presentation Lambertian shader?\ goal SIGGRAPH?2009?presentation rtDeclareVariable(float3, Ka);

rtDeclareVariable(float3, Kd);

rtDeclareVariable(float3, ambient_light_color);

rtBuffer lights;

RT_PROGRAM void closest_hit_radiance() { PerRayData_radiance&

prd = prd_radiance.reference();

Ray ray = incoming_ray.get();

float3 world_geo_normal = normalize( rtTransformNormal( RT_OBJECT_TO_WORLD, geometric_normal ) );

float3 world_shade_normal = normalize( rtTransformNormal( RT_OBJECT_TO_WORLD, shading_normal ) );

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题