i'm trying port shadertoy.com shader ( atmospheric scattering sample , interactive demo code) unity. shader written in glsl , have start editor c:\program files\unity\editor>unity.exe -force-opengl make render shader (otherwise "this shader cannot run on gpu" error comes up), that's not problem right now. problem porting shader unity. the functions scattering etc. identical , "runnable" in ported shader, thing mainimage() functions manages camera, light directions , ray direction itself. has ofcourse changed sothat unity's camera position, view direction , light sources , directions used. the main function of original looks this: void mainimage( out vec4 fragcolor, in vec2 fragcoord ) { // default ray dir vec3 dir = ray_dir( 45.0, iresolution.xy, fragcoord.xy ); // default ray origin vec3 eye = vec3( 0.0, 0.0, 2.4 ); // rotate camera mat3 rot = rot3xy( vec2( 0.0, iglobaltime * 0.5 ) ); dir = rot * dir; eye...
Comments
Post a Comment