Page 1 of 1

Model Skins and Brightmaps

Posted: Wed May 28, 2014 21:24
by Enjay
There has been a change with how brightmaps work when used with a model skin. I assume that it is to do with the extending of the 8 character limit.

Previously, the following worked:
[spoiler]MODELDEF

Code: Select all

Model DFFloorLamp
{ 
   Path "Models" 
   Model 0 "df_floor.md2" 
   Path "Textures" 
   Skin 0 "df_floor.png"
   Scale 0.4 0.4 0.4
   
   Frame POSS A 0 "frame01"
}
GLDEFS

Code: Select all

brightmap texture DF_FLOOR
{
	map "bm/df_floor.png"
}
[/spoiler]

As far as I can tell, the model skin needed to be in the textures folder for it to have a brightmap applied (I certainly couldn't get it to work any other way). This also meant that the skin name needed to be 8 characters or less to work. However, I noticed with recent builds that this system had stopped working.

Then, after a bit of trial and error, I found that this fixed it:
[spoiler]GLDEFS

Code: Select all

brightmap texture "textures/DF_FLOOR.png"
{
	map "bm/df_floor.png"
}
[/spoiler]
i.e. a full path was required to get the GLDEFS to "see" the skin.

Then, on a hunch, I tried putting the skin back into the models folder and modifying the paths accordingly. i.e.:
[spoiler]MODELDEF

Code: Select all

Model DFFloorLamp
{ 
   Path "Models" 
   Model 0 "df_floor.md2" 
   Skin 0 "df_floor.png"
   Scale 0.4 0.4 0.4
   
   Frame POSS A 0 "frame01"
}
GLDEFS

Code: Select all

brightmap texture "models/DF_FLOOR.png"
{
	map "bm/df_floor.png"
}
[/spoiler]
and it worked!

This is now a much saner way of doing it (i.e. the engine no longer needs to be fooled that the skin is a texture (so the textures folder does not have to be used) and names longer than 8 characters work too).

I just want to check that this is OK before I go ahead and convert all the model brightmaps that I have to comply with how things now work. I've got quite a lot of models using brightmapped skins.

Example file attached (it works with the current build and even uses a long file name) and a screenshot for great justice.

Image

Re: Model Skins and Brightmaps

Posted: Thu May 29, 2014 0:29
by Graf Zahl
If you define a brightmap to the texture exactly as named in the model it's all well defined.

The old, hacky way (didn't I warn you all to exploit such side effects! :P) doesn't work anymore because it depended on aliasing of the texture's name. Now that this aliasing is gone - for savegame stability reasons the long name texture needs to be different than the short name texture even if it refers the same lump - the brightmap assignment logically doesn't reach the intended skin anymore.

Re: Model Skins and Brightmaps

Posted: Thu May 29, 2014 0:45
by Enjay
Graf Zahl wrote:(didn't I warn you all to exploit such side effects! :P)
You did but I have to say that I specifically asked how acceptable this particular hack was a number of times, but didn't get a response. :P (I accept I took a risk in going ahead without receiving a response though. ;) )

No matter. The newer system is a much better way to do it. Thanks for letting me know it's acceptable. I can happily convert my stuff with confidence now. :D

I was worried that this change might also affect brightmapped sprites and textures using the PK3 folder system but they seem to be fine. Also, high resolution sprite replacements (using the hires folder inside a PK3 method) also still respect the brightmaps applied to their low-res counterparts (like they always have done) so that's good too.

i.e. the only brightmap related thing that I have found to be broken is a hacky method for getting model skins to work and this has now been replaced with a much better, much more robust method so this change is definitely an improvement from my perspective. Thanks once again.

Re: Model Skins and Brightmaps

Posted: Fri May 30, 2014 1:58
by Nash
Good to know there's a proper way to do this now!

Re: Model Skins and Brightmaps

Posted: Sun Feb 15, 2015 23:43
by StrikerMan780
Sorry for the major bump (figured it would be better than making a new thread.), but I take it this method only works with recent versions of GZDoom?

Re: Model Skins and Brightmaps

Posted: Mon Feb 16, 2015 0:28
by Enjay
Define recent. This thread is coming up for 9 months old. ;)

From memory, versions from before this wouldn't support this method (though there was an older hack which is unsupported as the posts above suggest).

Would this be a Zandronum related question? If so, then it's definitely more recent than the current version of Zandronum.

Re: Model Skins and Brightmaps

Posted: Mon Feb 16, 2015 8:49
by StrikerMan780
Zandronum 2.0 uses the GZDoom 1.5.0 renderer. So, I imagine that's pretty old at this point.