mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Texture better coede
This commit is contained in:
@ -91,8 +91,8 @@ bool intersectTriangle(Ray ray, GPUTriangle obj, out hitInfo hit)
|
||||
hit.v = v;
|
||||
hit.t = t;
|
||||
hit.position = ray.origin + ray.direction * t;
|
||||
// hit.normal = vec3(u, v, 1 - (u + v)); //texture mapping
|
||||
hit.normal = obj.normal * sign(-dot(ray.direction, obj.normal));
|
||||
// hit.normal = vec3(u, v, 1 - (u + v)); //texture mapping
|
||||
|
||||
return (valid);
|
||||
}
|
||||
|
@ -113,9 +113,7 @@ vec3 getTextureColor(int texture_index, hitInfo hit)
|
||||
|
||||
void calculateLightColor(GPUMaterial mat, hitInfo hit, inout vec3 color, inout vec3 light, inout uint rng_state)
|
||||
{
|
||||
if (mat.texture_index != -1)
|
||||
color *= getTextureColor(mat.texture_index, hit);
|
||||
|
||||
color *= mat.texture_index == -1 ? vec3(1.0) : getTextureColor(mat.texture_index, hit);
|
||||
color *= mat.color;
|
||||
light += mat.emission * mat.color;
|
||||
// light += sampleLights(hit.position, rng_state);
|
||||
|
@ -80,10 +80,8 @@ Ray transparencyRay(hitInfo hit, Ray ray, GPUMaterial mat, inout uint rng_state)
|
||||
|
||||
Ray newRay(hitInfo hit, Ray ray, inout uint rng_state)
|
||||
{
|
||||
GPUObject obj;
|
||||
GPUMaterial mat;
|
||||
|
||||
obj = objects[hit.obj_index];
|
||||
mat = materials[hit.mat_index];
|
||||
|
||||
if (mat.type == 0)
|
||||
|
Reference in New Issue
Block a user