Hi!
here's my latest Houdini achievement! This is a viewport screenshot using absolutely NO LIGHTS!
I created vectors from each point on the geo connecting to each points at the top left corner of the image. I check what hits and doesn't hit anything (black or white) and make an average(gives soft shadows). I also check if the surface is facing or perpendicular to the light source to change the brightness. I used the inversed square law (at least I think I did) to affect light decay. The SSS was achieved by simply using the blur sop with different values on the R, G and B components.
Vex lighting without using a single light
2348 3 0- olivierth
- Member
- 1004 posts
- Joined: 4月 2017
- Offline
- olivierth
- Member
- 1004 posts
- Joined: 4月 2017
- Offline
Here's the vex code. Input 0 is the geometry (rubber toy and squab!) and input 1 are the light points. I scattered the light points on a grid to simulate an area light.
int lightCount = npoints(1); float lightmult = pow(chf("exposure"), 3); vector rayN, hitpos, lightpos; int hitprim; float u, v; float lightmap = 0; float rayOffset = chf("ray_offset"); vector geoPtpos = @P + (@N * rayOffset); float angleToLight; float lightDist = 0; for(int i=0; i<lightCount; i++) { lightpos = point(1, "P", i); rayN = lightpos - @P; hitprim = intersect(0, geoPtpos, rayN, hitpos, u, v); if(hitprim == -1) { lightDist = distance(@P, lightpos); angleToLight = degrees(acos(dot(@N, normalize(rayN)))); angleToLight = fit(angleToLight, 0, 90, 1, 0); lightmap += ((1 / sqrt(lightDist)) ) * angleToLight; } } @Cd = lightmap / float(lightCount);
- Aizatulin
- Member
- 470 posts
- Joined: 7月 2005
- Offline
- olivierth
- Member
- 1004 posts
- Joined: 4月 2017
- Offline
-
- Quick Links