MODELDEF Translucency property?
Moderator: GZDoom Developers
MODELDEF Translucency property?
Or something that achieves the same goal but does it better?
Specifically, I'm thinking of actors that use multiple models where one of the models needs to be translucent but the rest don't.
e.g. 1 a vehicle would need its bodywork to be fully opaque, but the glass in its windows would be translucent. If the body was one model and the glass was another that could be set to be translucent, that would be ideal.
e.g. 2 a old fashioned street lamp with a solid metal frame and glass panels around its light source.
Obviously from the above screenshots, I've managed to fake it in the past by making the object two separate actors, each with their own models; one for the opaque bits and another with a translucent renderstyle for the bits you're meant to see through. That works well enough if you don't want the object to move but it can quickly fall apart (literally) when the actor needs to move.
Maybe there is a neat way of doing this already?
Specifically, I'm thinking of actors that use multiple models where one of the models needs to be translucent but the rest don't.
e.g. 1 a vehicle would need its bodywork to be fully opaque, but the glass in its windows would be translucent. If the body was one model and the glass was another that could be set to be translucent, that would be ideal.
e.g. 2 a old fashioned street lamp with a solid metal frame and glass panels around its light source.
Obviously from the above screenshots, I've managed to fake it in the past by making the object two separate actors, each with their own models; one for the opaque bits and another with a translucent renderstyle for the bits you're meant to see through. That works well enough if you don't want the object to move but it can quickly fall apart (literally) when the actor needs to move.
Maybe there is a neat way of doing this already?
- Major Cooke
- Posts: 8175
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: MODELDEF Translucency property?
As much as I would love this (not only for the aforementioned but also to cut down on actor count), I doubt it's possible without making changes to the MD3/OBJ formats themselves... maybe? Perhaps OBJ might already have support for it in some degree, but Nash will have to comment on the MD3 models.
What code are you using to move the child actors around with it? Perhaps I can help with that part, in the mean time, at the very least.
What code are you using to move the child actors around with it? Perhaps I can help with that part, in the mean time, at the very least.
Re: MODELDEF Translucency property?
Yeah, this information needs to be encoded into the exported model directly. Not sure where would be the best place to put this - I suppose it could be encoded per mesh group.
Neither MD3 nor OBJ have this kind of data in their original specs, so anything done here would be GZDoom-exclusive. Currently-existing exporters would also have to be updated to actually write this data so that GZDoom can make use of it.
(inb4 "GZDoom needs a new model format" ;))
Neither MD3 nor OBJ have this kind of data in their original specs, so anything done here would be GZDoom-exclusive. Currently-existing exporters would also have to be updated to actually write this data so that GZDoom can make use of it.
(inb4 "GZDoom needs a new model format" ;))
Re: MODELDEF Translucency property?
Does it really need to be encoded in the model though?
GZDoom clearly has the ability to show an actor that uses a model with translucency. I'm not asking for some bits of one model to be translucent and other bits not to be. I'm asking for "draw this model opaque, and that one translucent". It just so happens they would be attached to the same actor - but maybe that kind of separation isn't possible in GZDoom? Perhaps the underlying actor's renderstyle limits it to one type and one type only?
e.g. something like this from an end-user perspective is what I'm talking about:
Obviously model 0 would default to normal rendering.
I'm sure, if it's possible, something much better could be thought out, but that shows the principle of what I'm talking about.
GZDoom clearly has the ability to show an actor that uses a model with translucency. I'm not asking for some bits of one model to be translucent and other bits not to be. I'm asking for "draw this model opaque, and that one translucent". It just so happens they would be attached to the same actor - but maybe that kind of separation isn't possible in GZDoom? Perhaps the underlying actor's renderstyle limits it to one type and one type only?
e.g. something like this from an end-user perspective is what I'm talking about:
Code: Select all
Model ModelCar
{
Path "Models"
Model 0 "Car.md3"
Skin 0 "Car.png"
Model 1 "CarGlass.md3"
Skin 1 "CarGlass.png"
Scale 1.0 1.0 1.0
ModelRenderstyle 1 Translucent 128
FrameIndex POSS A 0 0
FrameIndex POSS A 1 0
}
I'm sure, if it's possible, something much better could be thought out, but that shows the principle of what I'm talking about.
Re: MODELDEF Translucency property?
I've done a few things in the past (DECORATE and ACS - not done anything with ZScript yet) and I usually end up seeing 1-tic jerkiness as things catch up to their intended position.Major Cooke wrote:What code are you using to move the child actors around with it? Perhaps I can help with that part, in the mean time, at the very least.
Simpler actors that I used in the past (ones that were just intended to be static) would simply spawn the second (and even third*) actor on top of themselves in their spawn state. So, that created two actors on the same spot looking as if they were one. That was all well and good until I put one on a conveyor belt that had a teleport line at one end to return it to the start of the conveyor. The two parts quickly went out of sync.
*Actually, that reminds me, something else that could be useful is the ability for a model to not replace a sprite. One of the 3-part actors I was talking about had a sprite component, an opaque component and a translucent component.
Spoiler:
Re: MODELDEF Translucency property?
This *might* be possible, but it adds into the pile of "let's just duct tape a new feature on to MODELDEF instead of doing it right".Enjay wrote:Does it really need to be encoded in the model though?
GZDoom clearly has the ability to show an actor that uses a model with translucency. I'm not asking for some bits of one model to be translucent and other bits not to be. I'm asking for "draw this model opaque, and that one translucent". It just so happens they would be attached to the same actor - but maybe that kind of separation isn't possible in GZDoom? Perhaps the underlying actor's renderstyle limits it to one type and one type only?
e.g. something like this from an end-user perspective is what I'm talking about:
Obviously model 0 would default to normal rendering.Code: Select all
Model ModelCar { Path "Models" Model 0 "Car.md3" Skin 0 "Car.png" Model 1 "CarGlass.md3" Skin 1 "CarGlass.png" Scale 1.0 1.0 1.0 ModelRenderstyle 1 Translucent 128 FrameIndex POSS A 0 0 FrameIndex POSS A 1 0 }
I'm sure, if it's possible, something much better could be thought out, but that shows the principle of what I'm talking about.
I mean, I'm not nay-saying, it's just that Graf has already expressed how unsatisfied he was with regards to MODELDEF, as far as adding features to it is concerned.
Still, if someone can hack this in a PR and if it is deemed an acceptable submission, I wouldn't complain. I'd probably use it.
Re: MODELDEF Translucency property?
Alternatively, implementing proper model rendering support for translucency in .png skins could work, too... Right now model skins seem to render as fully opaque unless the alpha value at that point on the texture is zero, so you can't just use a translucent texture to get this effect.
- phantombeta
- Posts: 2088
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: MODELDEF Translucency property?
This has already been done, you just have to set the renderstyle to Translucent. Do note, however, that you'll very likely have depth sorting issues - possibly even between the model's own triangles.AFADoomer wrote:Alternatively, implementing proper model rendering support for translucency in .png skins could work, too... Right now model skins seem to render as fully opaque unless the alpha value at that point on the texture is zero, so you can't just use a translucent texture to get this effect.
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: MODELDEF Translucency property?
Well, at least one of the supported model formats already supports providing renderstyle information.Enjay wrote:Does it really need to be encoded in the model though?
Whether that information is usable, that's another story. I think I asked before if it was possible to make each surface in a model have a different renderstyle but was told that no?
Re: MODELDEF Translucency property?
That's part of why I have asked if it can be done with separate models on the same actor, rather than different surfaces in the same model having different translucencies.Marisa Kirisame wrote:I think I asked before if it was possible to make each surface in a model have a different renderstyle but was told that no?
- Deybar_TECH
- Posts: 145
- Joined: Wed Dec 26, 2018 3:36 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 7
- Graphics Processor: Not Listed
- Location: El Alto - La Paz - BOLIVIA
- Contact:
Re: MODELDEF Translucency property?
I need a lot of transparency control in the models.
but it is possible that this may be a reality in the future like (A_SoundPitch)
but it is possible that this may be a reality in the future like (A_SoundPitch)
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: MODELDEF Translucency property?
I'd suggest a Style/SurfaceStyle property for modeldef if all of this actually is doable.
And yeah, as beta has mentioned, transparent model parts have their quirks when it comes to drawing order. It's not hard to account for this though. For example in blender all you'd need to do is rearrange the materials for the object so translucent ones are at the top.
And yeah, as beta has mentioned, transparent model parts have their quirks when it comes to drawing order. It's not hard to account for this though. For example in blender all you'd need to do is rearrange the materials for the object so translucent ones are at the top.
- Deybar_TECH
- Posts: 145
- Joined: Wed Dec 26, 2018 3:36 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 7
- Graphics Processor: Not Listed
- Location: El Alto - La Paz - BOLIVIA
- Contact:
Re: MODELDEF Translucency property?
Sorry but it would not be a better idea to adapt the controls and options of (MODELDEF) directly to the properties of the (Actor)?
Since there is a constant parameter within the GZDoom itself called (RFF_MODELS) and only a flag like this should be added or simply use this same flag on the objects so that their (sprites / frames) disappear and the Modeldef properties can be used. And so, add a (ModelStyle {<model index = 0> <model Style = MShaded>}) and that can be modified later in gameplay with a (A_SetModel-Style, Alpha, Scale, Frame, Angles, Offset, Flag {< model index> <effect>}) with this. I assure that more people will start using more 3D models instead of (sprites).
Code: Select all
// these flags are for filtering actor visibility based on certain conditions of the renderer's feature support.
// currently, no renderer supports every single one of these features.
enum ActorRenderFeatureFlag
{
RFF_FLATSPRITES = 1<<0, // flat sprites
/////>>>>>RFF_MODELS = 1<<1, // 3d models
RFF_SLOPE3DFLOORS = 1<<2, // sloped 3d floor support
RFF_TILTPITCH = 1<<3, // full free-look
RFF_ROLLSPRITES = 1<<4, // roll sprites
RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls
RFF_MATSHADER = 1<<6, // material shaders
RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers)
RFF_BRIGHTMAP = 1<<8, // brightmaps
RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife)
RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl)
RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor
RFF_VOXELS = 1<<12, // renderer is capable of voxels
};
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: MODELDEF Translucency property?
See now you're just going way too far ahead. That's something that has to wait first for the animation system overhaul.