Assigning materials to level blocks [SOLVED]

Posted By: TehV

Assigning materials to level blocks [SOLVED] - 07/12/14 17:18

I'm attempting to apply a specular bumpmapping shader to a level block (inserted by right click -> Add -> Cube -> Small). I am assigning a texture to it as well, by the name 'stonemarble'. To do this, I'm setting its material to marble_tile from within WED, like so:




Then, in the main code, I defined this material as follows:
Code:
//Materials & Shaders

BMAP* marble_texture = "textures\\stonemarble.bmp";
BMAP* marble_bump = "textures\\stonemarblebump.bmp";

MATERIAL* marble_tile = {
	skin1 = marble_texture;
	skin2 = marble_bump;
	effect = "specBump.fx";
}



When I start the game, I get a warning saying "STONEMARBLE: Normal or height map missing".

Does anyone know why this might be happening?
Posted By: DLively

Re: Assigning materials to level blocks - 07/12/14 17:37

Quote:

I am assigning a texture to it as well, by the name 'stonemarble'. To do this, I'm setting its material to marble_tile from within WED,


Make sure you've imported your WAD file, and double click the texture from the WAD file, while your block is selected to apply a texture.

Textures and Materials are two different things.

Perhaps you want to follow my WED tutorial laugh
Posted By: TehV

Re: Assigning materials to level blocks - 07/12/14 18:03

Originally Posted By: DLively
Quote:

I am assigning a texture to it as well, by the name 'stonemarble'. To do this, I'm setting its material to marble_tile from within WED,


Make sure you've imported your WAD file, and double click the texture from the WAD file, while your block is selected to apply a texture.

Textures and Materials are two different things.

Perhaps you want to follow my WED tutorial laugh


I'm already doing this. That's how I assigned the texture.

Perhaps my code was slightly misleading in that regard. I've assigned the same texture to the material because I assumed it would fix the problem I was having - which it didn't.
Posted By: CyberGhost

Re: Assigning materials to level blocks - 07/12/14 19:04

I think you should assign normalmap for the texture since you assigned a material and shader effect.
Posted By: Stansmedia

Re: Assigning materials to level blocks - 07/13/14 00:15

In your main function set this:
Code:
d3d_automaterial=1;



In your wad add your texture, ex.. stonemarble. Add your bump map texture to your wad file as this: stonemarble_n. Remember the alpha map of your normal map texture is used as the specular map.

Before your main function add this:

Code:
MATERIAL* stonemarble=
{
	specular_blue = 255;
	specular_green = 255;
	specular_red = 255;
	diffuse_red = 255;
	diffuse_blue = 255;
	diffuse_green = 255;
	specular_blue = 255;
	ambient_red = 0;
	ambient_blue = 0;
	ambient_green = 0;
	albedo = 200;
	power = 10;
	effect = "specBump.fx";
	flags = PASS_SOLID;
}



With d3d_automaterial, all your wed block textures will have the material with the same name applied to it. Make sure the wad file contains the normal map with the same name as the texture ending in _n.

edit:

Quote:
When I start the game, I get a warning saying "STONEMARBLE: Normal or height map missing".


Your normal map texture is a BMP. BMP files do not support alpha maps. The engine is probably looking for the specular map in the alpha channel and not finding it. TGA or DDS files can save with alpha channels.

One thing to keep in mind if your trying to use other shaders with wad textures is that the normal map textures ending in _n are placed in the entskin3 slot by the engine, not entskin2 like most shaders require.
Posted By: TehV

Re: Assigning materials to level blocks - 07/14/14 22:10

Originally Posted By: Stansmedia
In your wad add your texture, ex.. stonemarble. Add your bump map texture to your wad file as this: stonemarble_n. Remember the alpha map of your normal map texture is used as the specular map.


That was the problem. I didn't have my bump map in the wad, and attempted to assign it via script. Thanks!
© 2024 lite-C Forums