Saturday, May 19, 2012

No Smoothing...

Looks like there's just no way to get around the fact that smooth normals can cause problems :/ I may have to drop them, at least for the ship.  Here's the same image using the actual analytic normals:


It would be nice if I could set it up to do analytic normals for the ship and interpolated normals for the asteroids...

Fresnel Metal

It's always depressing to me when I hear birds chirping before I go to bed.  Tonight is, unfortunately, one of those nights.  But for my troubles I have been rewarded!

I finally implemented a Fresnel-like term in the tracer.  I really want to get a nice metallic look for the spaceship (I mean, that's pretty much an essential!).  To that end, I implemented a metallic Fresnel approximation from this paper: http://sirkan.iit.bme.hu/~szirmay/fresnel.pdf.  It actually looks really nice!


My ship is finally starting to remind me of those first few renders that I did in PBRT ages ago.  Yay, that means I'm getting close to PBRT's quality!

Except for those horrendous black edges.  Don't mind those.  I'll have to look into it...I'm sure they're just bad mesh normals.  Rawr.

Friday, May 18, 2012

Don't Stretch It

One of the most annoying yet easy-to-make mistakes when it comes to drawing rendertargets to the screen is accidentally invoking filtering.  Even the slightest difference between the rendertarget size/placement and the viewport size/placement can cause stretching, which will invoke the minifaction or magnification texture filter.  If you've set them to "linear," which is a reasonable thing to do, the result is effectively a 2x2 box blur over your whole image.  Nice.  You've just halved the effective resolution.  In the case of D3D9, it's even worse, because you're not safe even if you've got the size right: the texel-to-pixel half-offset madness can still cause the same effect.

Up until a few minutes ago, my path tracer was suffering from this problem.  I noticed it immediately when I switched from GL to CUDA, but figured it might be a CUDA-specific thing and decided to wait until a later time to debug it.  But it occurred to me today that it might be my good old friend texture filtering!  And indeed it was.  Changing the filtering to nearest-neighbor fixed it immediately.  My images now look significantly sharper at edges and high-frequency details.  Here's a comparison:



The latter is correct.

In conclusion: if you think your image looks blurred, texture filtering is probably the culprit!

Thursday, May 17, 2012

Scattering Study

I should be working on textures right now.  But I'm not!  Now that I've got a material system in place, there's just too much fun to be had elsewhere :D  For example...arbitrarily-shaped emitters!  And you know what that means...I can finally make the mining beam.  To that end, I've been doing some scattering studies tonight.

Here's a beam cutting through sinusoidal clouds of gas:


Here's the same beam with twice the luminosity:


I really love the way the multiple scattering saturates the nearby gas with color.  That's exactly the effect that I'm looking for!  I'm still wondering if this scattering is exactly correct....I'm a little concerned about the visible silhouettes of the two beams through the gas on the top layer.  Maybe that's correct, but it looks a little odd to me.

And, just for fun, here's an awesome-colored beam of the same intensity as the last one:


Wednesday, May 16, 2012

Better Field

Texture really makes a difference on those asteroids.  Dare I say it?  I think the images are actually starting to look good...!


More Texture

I know that ship texture's a disaster...but don't count me out yet, texture week has only just begun! :D


Getting Somewhere

Tonight I implemented texture atlas generation, integrated a basic material system into Welder, and hooked it up to the GPU tracer, making all the necessary memory arrangements.  I also attached material flags to each triangle, so that materials can be specified on a per-triangle basis.  Pretty awesome rate of accomplishments for tonight!

Here's a little reward for my efforts.  Nothing fantastic, but at least it's starting to look vaguely spacey: