Model Skins and Brightmaps

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
User avatar
Enjay
Developer
Developer
Posts: 4723
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Model Skins and Brightmaps

Post 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
Attachments
modelbright.pk3
Works with current Git builds
(21.42 KiB) Downloaded 163 times
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Model Skins and Brightmaps

Post 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.
User avatar
Enjay
Developer
Developer
Posts: 4723
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Model Skins and Brightmaps

Post 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.
User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Re: Model Skins and Brightmaps

Post by Nash »

Good to know there's a proper way to do this now!
User avatar
StrikerMan780
Posts: 21
Joined: Fri Nov 23, 2007 10:11
Location: Somewhere in Cyberspace

Re: Model Skins and Brightmaps

Post 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?
User avatar
Enjay
Developer
Developer
Posts: 4723
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Model Skins and Brightmaps

Post 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.
User avatar
StrikerMan780
Posts: 21
Joined: Fri Nov 23, 2007 10:11
Location: Somewhere in Cyberspace

Re: Model Skins and Brightmaps

Post by StrikerMan780 »

Zandronum 2.0 uses the GZDoom 1.5.0 renderer. So, I imagine that's pretty old at this point.
Locked

Return to “GZDoom”