Presentation is loading. Please wait.

Presentation is loading. Please wait.

Árnyalás Szécsi László. giraffe.jpg letöltése SolutionDir/Media folderbe.

Similar presentations


Presentation on theme: "Árnyalás Szécsi László. giraffe.jpg letöltése SolutionDir/Media folderbe."— Presentation transcript:

1 árnyalás Szécsi László

2 giraffe.jpg letöltése SolutionDir/Media folderbe

3 copy-paste-rename gg005-Cam folder vcxproj, filters átnevezés solution/add existing project rename project working dir: $(SolutionDir) Project Properties/Configuration Properties/Debugging/Command Arguments --solutionPath:"$(SolutionDir)" --projectPath:"$(ProjectDir)" build, run

4 solution fx folderbe shaded.fx

5 #include float3 lightPos = float3(1, 1, 1); float3 lightPower = float3(50, 50, 50); float3 kd = float3(1, 0, 1); //lila #7.0

6 float4 psDiffuse(VsosTrafo input) : SV_Target { float3 normal = normalize(input.normal); float3 toLight = lightPos - input.worldPos.xyz; float3 lightDist2 = dot(toLight, toLight); float3 lightDir = normalize(toLight); return float4( kd * saturate(dot(lightDir, normal)) * lightPower / (4 * 3.14 * lightDist2), 1); } #7.1

7 technique11 shaded { pass diffuse { SetVertexShader ( CompileShader( vs_5_0, vsTrafo() ) ); SetPixelShader( CompileShader( ps_5_0, psDiffuse() ) ); } #7.1

8 #include // and nothing else #7.1

9 ID3DX11EffectPass* basicPass = effect- >GetTechniqueByName("idleshaded")- >GetPassByName("idlediffuse"); Egg::Mesh::Material::P idleshadedMaterial = Egg::Mesh::Material::create(basicP ass, 0); shadedMesh = binder- >bindMaterial(idleshadedMaterial, indexedMesh); #8.0

10

11 float3 eyePos; float3 ks = float3(10, 10, 10); float n = 10; #7.1

12 effect-> GetVariableByName("eyePos")-> AsMatrix()-> SetMatrix( (float*)& firstPersonCam->getEyePosition() ); #8.0

13 float4 psSpecular(VsosTrafo input) : SV_Target { float3 normal = normalize(input.normal); float3 toLight = lightPos - input.worldPos.xyz; float3 lightDist2 = dot(toLight, toLight); float3 lightDir = normalize(toLight); float3 toEye = eyePos - input.worldPos.xyz; float3 viewDir = normalize(toEye); return float4( (kd * saturate(dot(lightDir, normal)) + ks * pow( saturate(dot( reflect(-viewDir, normal), lightDir)), n) ) * lightPower / (4 * 3.14 * lightDist2), 1); } #7.1

14 technique11 shaded { pass diffuse { SetVertexShader ( CompileShader( vs_5_0, vsTrafo() ) ); SetPixelShader( CompileShader( ps_5_0, psDiffuse() ) ); } pass specular { SetVertexShader ( CompileShader( vs_5_0, vsTrafo() ) ); SetPixelShader( CompileShader( ps_5_0, psSpecular() ) ); } #7.1

15 ID3DX11EffectPass* basicPass = effect- >GetTechniqueByName("shaded")- >GetPassByName("diffusespecular"); Egg::Mesh::Material::P shadedMaterial = Egg::Mesh::Material::create(basicP ass, 0); shadedMesh = binder- >bindMaterial(shadedMaterial, indexedMesh); #8.0

16

17 keringő fényforrás – animate metódusban a fénypozíció újrabeállítása


Download ppt "Árnyalás Szécsi László. giraffe.jpg letöltése SolutionDir/Media folderbe."

Similar presentations


Ads by Google