Jump to content

Normal/Specular map not being applied


omniglitch
 Share

Recommended Posts

I bought LE 2.43 a couple days ago and I've been working through the tutorials. When I got to Introduction to Models I ran into a display issue where the Normal/Specular shader for the oil drums don't seem to be working. They're only shaded with the diffuse texture.

 

I've watched the video for that tutorial and saw that they should be shaded in all their normal map and specular glory using the code example from the tutorial (which I copied and pasted from the tutorial's PDF). I also downloaded the required files and placed them in my project's folder, along with the required .DLLs and shaders.pak.

 

The oil drum model displays normals and specular correctly in the ModelViewer app, just not in my app which uses the tutorial's code verbatim.

 

As I understand it, the LoadModel function should automatically open the .mat file which matches the filename of the .gmf file specified, which will then automatically load the textures and shaders specified in the .mat file, which is what it appears to be doing. The console's output indicates that it's loading the textures and shaders (mesh_diffuse_bumpmap.vert and mesh_diffuse_bumpmap_specular.frag) ok. It should be working.

 

Am I missing something?

Link to comment
Share on other sites

As for a demo others can try, the code can be grabbed from the Introduction to Models tutorial.

 

I've also tried to get normals/specular working with the LoadMesh command. For example:

 

#include "engine.h"

int main(int argc, char** argv)
{
Initialize();

//Create a graphics context
Graphics(800,600);

//Load SDK directory
RegisterAbstractPath("C:\\Leadwerks Engine SDK");

//Create a world
if (!CreateWorld()) {
	MessageBoxA(0,"Failed to create world.","Error",0);
	goto exitapp;
}

//Create a camera
TEntity cam=CreateCamera();
CameraClearColor(cam,Vec4(0,0,1,1));
PositionEntity(cam,Vec3(0,-0.5,-2));
RotateEntity(cam,Vec3(-20,0,0));

//Create a light
TLight light=CreateDirectionalLight();
RotateEntity(light,Vec3(45,45,0));

//Create a render buffer
TBuffer buffer=CreateBuffer(800,600,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL);

//Load a mesh
TModel mesh=LoadMesh("oildrum.gmf");
if (!mesh) {
	MessageBoxA(0,"Error","Failed to load mesh.",0);
	goto exitapp;
}

//Main loop
while(!KeyHit(KEY_ESCAPE)) {

	//Update the world
	UpdateWorld();

	//Render the scene
	SetBuffer(buffer);
	RenderWorld();

	//Render lighting
	SetBuffer(BackBuffer());
	RenderLights(buffer);

	//Swap the front and back buffer
	Flip();
}

exitapp:
return Terminate();
}

 

These sorts of shaders work fine with the model viewer and with all the games I play. Not sure how I would troubleshoot a config issue other than to update my video driver, which I'll try. I'm also going to load my compiled app onto a friend's computer later today and see if normals/specular works there.

Link to comment
Share on other sites

Actually, how do you know that normals and speculars are not working? You don't seem to have anykind of camera movement in the example.

I think they work just fine, but you are looking at the oildrum from an angle which doesn't show them much.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

It's working here. I made a point light and turned the light's intensity value up a bit:

post-1-0-42418200-1311099922_thumb.jpg

 

Some people may have adjusted the normal map a bit, or have another normal map applied. The specular intensity is stored in the alpha channel of the normal map. If you make the alpha channel brighter, you get more specular reflection.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Here's where a picture--or two--is worth a thousand words...

 

I was thinking I'd see something like this screenshot from the tutorial:

Specular.jpg

 

But when I compile the tutorial code I see this:

NotSpecular.jpg

 

It looks the same when I run it on a friend's computer. Very dull, as you can see from the screenshot. I even tried throwing in a moving point light, but didn't get any shininess out of the barrels. It's like the normal/specular map is being ignored.

 

I opened oildrumdot3.dds in Paint.NET and confirmed every pixel in the alpha channel is 255. That should make it very shiny.

 

I was wondering, when the console output says it's Loading texture, or Loading shader, does that mean it's beginning the attempt to load it, or is it a confirmation that it's been loaded?

Link to comment
Share on other sites

Use Windows Texture Viewer. Paint.NET does not load alpha channels, apparently:

http://developer.nvidia.com/content/windows-texture-viewer

 

Here, the background color is black. You can see how dark the alpha channel is:

post-1-0-23588300-1311174418_thumb.jpg

 

I'm sorry they don't look the way you want, but a lot of people were complaining that the material was too shiny so I toned it down.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

One thing you can do to easily change this is open the oildrum.mat material file in a text editor and add a value to increase the specular reflection:

texture0="abstract::oildrum.dds"
texture1="abstract::oildrumdot3.dds"
shader="abstract::mesh_diffuse_bumpmap.vert","abstract::mesh_diffuse_bumpmap_specular.frag"
specular=500.0

However, increasing the specular value in the normal map will work better.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

The new oildrum specular is horrible. I wonder who suggested to tune it down, because now it looks as ugly as CoD or something. Crysis uses realistic higher specular values which makes it the only game which looks realistic.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

The new oildrum specular is horrible. I wonder who suggested to tune it down, because now it looks as ugly as CoD or something. Crysis uses realistic higher specular values which makes it the only game which looks realistic.

 

I do not see a anything wrong with the newer oildrum. They are rusty and it is more realistic without the specular set to high. It would be different if the oildrum looked new.

Link to comment
Share on other sites

Yeah, but the specular is there to bring more contract in the color range. You should also darken the ambient a lot that it doesn't look so flat.

In real even a matte rusty oildrum has a greate color spectrum, which can be only achieved with HDR+SSAO+specular+dark ambient:

http://1.bp.blogspot.com/-6pWTuEIVdUQ/TgAPO2oBV5I/AAAAAAAAAEs/7T0_NfZEn9o/s1600/IMG_2833.JPG

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Yeah, but the specular is there to bring more contract in the color range. You should also darken the ambient a lot that it doesn't look so flat.

In real even a matte rusty oildrum has a greate color spectrum, which can be only achieved with HDR+SSAO+specular+dark ambient:

http://1.bp.blogspot.com/-6pWTuEIVdUQ/TgAPO2oBV5I/AAAAAAAAAEs/7T0_NfZEn9o/s1600/IMG_2833.JPG

 

That is still nowhere near as shiny as the old LE one though. :)

Intel core 2 quad 6600 | Nvidia Geforce GTX460 1GB | 2GB DDR2 Ram | Windows 7.

 

Google Sketchup | Photoshop | Blender | UU3D | Leadwerks Engine 2.4

Link to comment
Share on other sites

Yeah, but the specular is there to bring more contract in the color range. You should also darken the ambient a lot that it doesn't look so flat.

In real even a matte rusty oildrum has a greate color spectrum, which can be only achieved with HDR+SSAO+specular+dark ambient:

http://1.bp.blogspot.com/-6pWTuEIVdUQ/TgAPO2oBV5I/AAAAAAAAAEs/7T0_NfZEn9o/s1600/IMG_2833.JPG

 

Lum, you should really put some better clothes on for this kind of works!

You know some smaller shrapnels can cut right through your shirt and harm you!

 

Also I would argue that the majority of the oil drums probably is in the gulf of mexico and with all the oil there should be some much more realistic shader to display the oil film more correctly.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...