Search found 15 matches

by RyanClark
Wed Sep 05, 2007 5:22 pm
Forum: Code Snippets
Topic: Better Collada and OBJ support...
Replies: 10
Views: 5224

Here is the teapot model used in the above images.

http://cggmwww.csie.nctu.edu.tw/courses/cgu/2002/prog1/teapot.obj


Seams will appear when you use the mesh manipulator to calculate "smooth" normals. or to generate a smooth tangent space using the code I posted previously. http://irrlicht ...
by RyanClark
Wed Sep 05, 2007 5:08 pm
Forum: Code Snippets
Topic: Better Collada and OBJ support...
Replies: 10
Views: 5224

Oops! Thanks for pointing that out!

I started writing an > operator, realized it wasn't needed, and left it unfinished.

I've removed it now. My apologies :)
by RyanClark
Tue Sep 04, 2007 11:08 pm
Forum: Code Snippets
Topic: Better Collada and OBJ support...
Replies: 10
Views: 5224

I've updated the code now. I'm developing against v1.31. I hope I'm not duplicating work that's already been done!

I'm not actually looking at smoothing group flags; all I'm doing is sharing identical vertices between faces. For some reason, the old code was breaking faces apart, duplicating ...
by RyanClark
Tue Sep 04, 2007 5:42 pm
Forum: Code Snippets
Topic: Better Collada and OBJ support...
Replies: 10
Views: 5224

Cool.

I'm actually seeing some terrible loadtimes with this code because it's doing dumb things. I need to fix the performance and re-post...
by RyanClark
Tue Sep 04, 2007 2:32 pm
Forum: Code Snippets
Topic: Better Collada and OBJ support...
Replies: 10
Views: 5224

Better Collada and OBJ support...

Hi all,

Here's an update to the OBJ loader, to preserve smoothing groups. This is necessary for proper normal-mapping. Also an update to the Collada loader, which preserves smoothing groups AND adds support for meshes in the Collada 1.4 format.

http://www.ryanclark.net/irrlicht/S3DVertex.h ...
by RyanClark
Tue Aug 07, 2007 11:31 pm
Forum: Code Snippets
Topic: Angle-weighted normals for nice-looking meshes.
Replies: 0
Views: 1805

Angle-weighted normals for nice-looking meshes.

Hi all,

Here's code to create mesh normals using the "Mean Weighted by Angle" method, which looks better than the default Irrlicht method.

http://ryanclark.net/irrlicht/CMeshManipulator.cpp

You can compare methods by toggling #define USE_ANGLE_WEIGHTED_NORMALS



Here is the relevant bit from ...
by RyanClark
Tue Aug 07, 2007 5:24 am
Forum: Code Snippets
Topic: A patch to improve normal mapping
Replies: 11
Views: 5507

You're right - If your normals aren't smooth they won't be perfectly orthogonal to the tangent planes. I don't know how much difference that makes. It seems to look good, but might look better if I add a postpass to rotate the tangent and bitangent into alignment with the pre-existing normal.

My ...
by RyanClark
Mon Aug 06, 2007 5:27 am
Forum: Code Snippets
Topic: Another patch to improve normal mapping!
Replies: 8
Views: 3851

Sweet, Thanks!

Don't you want to keep those normalizations in the VS, though? Otherwise vertices will have unequal weight when you interpolate between them.

Also, it's important to normalize "normalMapColor" before you use it. Even if the pixels in your normalmap were normalized on disc, texture ...
by RyanClark
Sat Aug 04, 2007 7:27 pm
Forum: Code Snippets
Topic: Another patch to improve normal mapping!
Replies: 8
Views: 3851

Oops!

I uploaded the code this morning with a line commented out for debugging!

I just fixed it, so if you've already downloaded the code, please re-download.

sorry about that,

-Ryan
by RyanClark
Sat Aug 04, 2007 7:10 pm
Forum: Code Snippets
Topic: Another patch to improve normal mapping!
Replies: 8
Views: 3851

Yeah, I've seen that weirdness in the GL shaders.

I haven't written GL shaders before, but they don't look much different. I'll look and see if I figure them out.

Just to clarify: this new ps2.0 shader is only for materials without parallax. Parallax materials still use the original 1.4 shader.
by RyanClark
Sat Aug 04, 2007 12:59 pm
Forum: Code Snippets
Topic: Another patch to improve normal mapping!
Replies: 8
Views: 3851

If you're curious to see just the new code, click here: http://ryanclark.net/irrlicht/CD3D9Norm ... nderer.cpp

It's basically the same as the 1.1 shader except that all the vectors get normalized at every pixel. This results in brighter and more accurate lighting.
by RyanClark
Sat Aug 04, 2007 12:21 pm
Forum: Code Snippets
Topic: Another patch to improve normal mapping!
Replies: 8
Views: 3851

Another patch to improve normal mapping!

Hi all,

I've written a PS 2.0 shader for normal mapping in DirectX 9. It calculates lighting more accurately, and makes a better-looking image.

Here's an illustration.
http://ryanclark.net/irrlicht/NewShader.png


Here's a patch containing this shader along with the tangentspace fix that I ...
by RyanClark
Sun Jul 22, 2007 11:34 pm
Forum: Code Snippets
Topic: A patch to improve normal mapping
Replies: 11
Views: 5507

Sure. Feel free to publish the code changes under whatever license you'd like!
by RyanClark
Sun Jul 22, 2007 10:08 pm
Forum: Code Snippets
Topic: A patch to improve normal mapping
Replies: 11
Views: 5507

I expect faster performance, since models turn out smaller than with the default code. I haven't tested, though.

If you're generating tangent space every frame, such as for a dynamic mesh, then you might find the default Irrlicht code faster.

You can toggle between the methods at compile time ...
by RyanClark
Sun Jul 22, 2007 9:15 pm
Forum: Code Snippets
Topic: A patch to improve normal mapping
Replies: 11
Views: 5507

A patch to improve normal mapping

Hi,

This code preserves the artist's original normals when calculating tangent space. This way, normal-mapped models should look closer to the artist's intent. Smooth surfaces will stay smooth, and flat surfaces will stay flat.

Here's an illustration:

http://ryanclark.net/irrlicht/BeforeAfter ...