This project is read-only.

Combining tutorial 14 (materials) with tutorial 28 (HDR)

May 9, 2010 at 1:22 AM

I was hoping for a bit of advice on a resent attempt.  I've successfully added the GroundDisk and lights from tutorial 14 to tutorial 28 but I can't see the texture and normal mapping until I turn the exposure way down.  Is there a setting (perhaps specularity related) that I might be missing for my GroundDisk?

I made the following tweaks to convert the disk from Z-up to Y.

position = new Vector3((float)Math.Sin(angle) * size, 0, -(float)Math.Cos(angle) * size);

normal = new Vector3(0, 1, 0);

binormal = new Vector3(1, 0, 0);

tangent = new Vector3(0, 0, 1);

tex = new Vector2(position.X, position.Z) * texScale;

I completely guessed on the normal, binormal, and tangent.

I'll continue playing with this, but I thought I'd throw it out there in case I was just missing something simple.  This API seems to have a lot of potential.

Thanks,

Focaccio

May 9, 2010 at 11:46 AM

Hi. It's probably unrelated:

The HDR tutorial renders the scene in RGBM format, as a way to avoid using full FP16 HDR (less memory + antialiasing). However, this requires each shader to output in that format.
MaterialShader doesn't output in RGBM format, it'll be outputting alpha as a constant 1.0, which in RGBM encoding means it's a really huge number (Tut 28 uses a scale of 200).

May 9, 2010 at 6:20 PM

Yes, that was indeed the issue.  I was able to solve it last night by setting the alpha to 0.05 (which would counter the 200).  My next step is to get the ground to recognize the sun position etc, rather than the two lights.  We'll see how it goes.

Thanks,

Focaccio

May 10, 2010 at 7:04 PM
Edited May 10, 2010 at 7:04 PM

The other option is to modify the tutorial to use an FP16 render target, and remove the conversions to and from RGBM. This will preserve high dynamic range data, however you will lose anitialiasing on some hardware including the xbox (make sure to check for support if you plan to use it) and it may be mildly slower (but probably not by much).

The final option is simply to write your own shader :-)