Jump to content

2 normal maps per model ?


motorsep
 Share

Recommended Posts

Do you know if it's possible to have 2 normal maps per surface (material) ?

For example, I want to have a large rock with one normal map defining general shape details (non-tiling, fits the model) and second normal map defining smaller details, tiling over the surface.

I recall there was something like adding normal maps or adding normal and heightmap in Doom 3, but I am not sure how (if possible at all) to make one texture just fit the model as if it was just a regular func_static with regular material, and have "detail" normal map being added to the original one, but having it tiling, as if it was like a wall textures.

 

Thanks.

Link to comment
Share on other sites

Image Program Functions
These can be used anywhere that accepts <map> and can be nested

 

addnormals(<map>, <map>)

 

Adds two normal maps together. Result is normalized.

  • Like 1

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Yes, except those have to occupy the same UV space.

 

Imagine a model. Bake out normal map for it that represents major detail on the model. The image is 2048 x 2048. Then take a "detail" normal map, tileable, 512 x 512 size. If you do addnormals with those two, the first one will fit fine, but the second one will be stretch to fit UV space. I need for second one to be tiled over UV space and I should be able to set tiling parameters.

Link to comment
Share on other sites

Yeah, I'll have to look at existing materials but I think you can use scale on the second normal... but you are correct that you cannot give it unique UV coords.

It would be a cool feature, true.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Hmm interesting, can you give a full example so I/others can see where to insert the extra details in the material def.

 

 

I've been told we shouldn't be using addnormals because if/when we get normalmap compression it won't be compatible.

Link to comment
Share on other sites

 

I've been told we shouldn't be using addnormals because if/when we get normalmap compression it won't be compatible.

 

Doom 3 BFG uses compression for normal maps and works with addnormals. What it does it adds normal maps, and saves it into a new image, which gets compressed. All done automatically.

Link to comment
Share on other sites

Anything is possible, I recall the roadblock to normal compression was mixing "grey-scale heightmaps" and normalmaps but it may be that BFG dropped heightmaps

altogether?

 

https://www.iddevnet.com/doom3/bumpmaps.php

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Here is an example made in Blender:

 

 

Top node tree is normal map #1, that is baked from high poly. That one doesn't tile.

 

Bottom node tree is normal map #2, aka "details" normal map. That one needs to tile.

 

When I set mapping to 1, 1, 1 in the video, it shows what Doom 3 engine does by default. It stretches normal map #2 to fit UV space of the model. And the goal is to have it tiling, like I show further in the video.

Link to comment
Share on other sites

@Biker: Here is an example material from Angua currently in-use:

 

 

 

 

 

 
// Author: angua
textures/darkmod/stone/sculpted/engraved_tile_star
{
    stone

    qer_editorimage    textures/darkmod/stone/sculpted/engraved_tile_star_ed
    diffusemap         textures/darkmod/stone/natural/light_grey_rough
    bumpmap            addnormals(textures/darkmod/stone/sculpted/engraved_tile_star_local, textures/darkmod/stone/sculpted/sarcophagus_stone02_roughness_local)

    {
        if ( parm11 > 0 )
        blend       gl_dst_color, gl_one
        map         _white
        rgb         0.40 * parm11
    }
    {
        if ( parm11 > 0 )
        blend       add
        map         textures/darkmod/stone/natural/light_grey_rough
        rgb         0.15 * parm11
    }

    // TDM Ambient Method Related
    {
        if (global5 == 1)
        blend add
        map                textures/darkmod/stone/natural/light_grey_rough
        scale            1, 1
        red                global2
        green            global3
        blue            global4
    }
    {
        if (global5 == 2)
        blend add
        program    ambientEnvironment.vfp
        vertexParm        0        1, 1, 1, 1        // UV Scales for Diffuse and Bump
        vertexParm        1        1, 1, 1, 1    // (X,Y) UV Scale for specular
        vertexParm        2        global2, global3, global4, 1

        fragmentMap        0        cubeMap env/gen1
        fragmentMap        1        addnormals ( textures/darkmod/stone/sculpted/engraved_tile_star_local , textures/darkmod/stone/sculpted/sarcophagus_stone02_roughness_local )            // Bump
        fragmentMap        2        textures/darkmod/stone/natural/light_grey_rough            // Diffuse
        fragmentMap        3        _black            // Specular
    }
}
 

 

 

 

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

NPC's textures use addnormals, for example:

 

 

models/md5/chars/guards/citywatch/citywatch_armor      //used for pauldrons&helmet only    -- should now be redundant?
{
	qer_editorimage	models/md5/chars/guards/citywatch/cityguard_armor_ed
	surftype15
	description "armor_plate"
        noselfshadow


        bumpmap		addnormals( models/md5/chars/guards/citywatch/cityguard5_local, heightmap( models/md5/chars/guards/citywatch/cityguard_h, 2 ) )
        diffusemap     models/md5/chars/guards/cityguard_armor
        specularmap    models/md5/chars/guards/cityguard_s
    {
        if ( parm11 > 0 )
        blend       gl_dst_color, gl_one
        map         _white
        rgb         0.40 * parm11
    }
    {
        if ( parm11 > 0 )
        blend       add
        map         models/md5/chars/guards/cityguard_armor
        rgb         0.15 * parm11
    }

	// TDM Ambient Method Related 
	{							
		if (global5 == 1)		
		blend add				
		map				models/md5/chars/guards/cityguard_armor		
		scale			1, 1		
		red				global2	
		green			global3	
		blue			global4	
	}							
	{							
		if (global5 == 2)		
		blend add				
		program	ambientEnvironment.vfp	
		vertexParm		0		1, 1, 1, 1		// UV Scales for Diffuse and Bump	
		vertexParm		1		1, 1, 1, 1	// (X,Y) UV Scale for specular		
		vertexParm		2		global2, global3, global4, 1	
																
		fragmentMap		0		cubeMap env/gen1				
		fragmentMap		1		addnormals ( models/md5/chars/guards/citywatch/cityguard5_local , heightmap ( models/md5/chars/guards/citywatch/cityguard_h , 2 ) )			// Bump				
		fragmentMap		2		models/md5/chars/guards/cityguard_armor			// Diffuse			
		fragmentMap		3		models/md5/chars/guards/cityguard_s			// Specular			
	}
}

 

 

 

Question is whether you can scale the heightmap or the second normalmap. I suspect it's not possible.

It's only a model...

Link to comment
Share on other sites

Ah yes I have seen this before and alwasy wonder what it did/was.

 

 

That particular line doesn't do anything. It's in the "if (global5 == 2)" block that is no longer used.

Link to comment
Share on other sites

NPC's textures use addnormals, for example:

 

 

        bumpmap		addnormals( models/md5/chars/guards/citywatch/cityguard5_local, heightmap( models/md5/chars/guards/citywatch/cityguard_h, 2 ) )

 

 

 

Question is whether you can scale the heightmap or the second normalmap. I suspect it's not possible.

 

What is number "2" for in that line ?

Link to comment
Share on other sites

Bugger, so how would we use more than one normal moving forward..?

the lines next to fragment map are useless. but the ones at the top of the material work as expected.

  • Like 1

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

 

What is number "2" for in that line ?

 

'heightmap(<map>, <float>) Turns a grayscale height map into a normal map. <float> varies the bumpiness.' -- https://www.iddevnet.com/doom3/materials.php

 

'An addition scale parameter is required when using height maps to determine how deep the image is supposed to be. You can’t properly cut and paste image fragments between height maps with different scale values without distorting the shading.' -- https://www.iddevnet.com/doom3/bumpmaps.php

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

  • 3 weeks later...

I'm pretty interested in the implications of this thread - if I wanted to make a model that:

- uses a normalmap from a high-poly version

- uses a stock texture, which also has a normalmap

 

Would it be right to say the only way to solve the normalmap conflict is to:

- duplicate the stock texture shader and let the new one use my model's normalmap

- and therefore adapt the high-poly mesh so that it also models details in the texture

 

Also, as far as I know every face needs to have its own place on the UV-map in order for hi-poly normalmap baking to function, which can be a problem with stock textures that weren't designed to fit the model's UV-map.

 

 

So it looks like stock textures are fairly unsuitable for models that have a normalmap from a hi-poly version.

  • Like 1
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.

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

  • Recent Status Updates

    • STiFU

      Anyone here played Inscryption? At first, I was like "no, I am not going to play a stupid card game", but this game is so much more than that. It is so meta, full of 4th wall breaks, and feels so damn spooky and weird because of it. Absolutely recommended, if you can stand the visuals. I recommend not reading up too much on it, as that could easily spoil half the incredible surprises. Just know that what you see in the beginning is by far not everything.
      · 1 reply
    • freyk

      Tried to make a tdm advertisement commentpost at one of civvie11 youtube videos about T2. Post got marked as spam. His problem (to not discover TDM for himself),..not my problem.
      But some help of some fellow TDM yt-videocomment posters would be nice. To ask him and others, to play TDM. To get more players/creators. 
      · 2 replies
    • datiswous

      Currently Profile Information has 3 fields, these are shown in forum posts under your avatar:
      1. Gender
      2. Location
      3. Interests
      I think that it could be useful to have an extra field called "Operating system" (under location). It can be useful for tech support and to see what people use.
      Alternatively it could be a more general term, like PC system, so that you can for example state that you use an AMD gpu.
      · 2 replies
    • OrbWeaver

      Greetings fellow kids.
      · 11 replies
    • Crafty_Creeper

      Keep on Creeping on...
       
      · 3 replies
×
×
  • Create New...