Changing Surface Skin in a 3D model????

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
edypagaza
Posts: 78
Joined: Mon Mar 07, 2016 12:35 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Changing Surface Skin in a 3D model????

Post by edypagaza »

Hi, i want to know if is possible to change the texture of a 3d model
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Changing Surface Skin in a 3D model????

Post by ramon.dexter »

Yes, it is possible.

If you want more elaborate answer, specify your question.
User avatar
edypagaza
Posts: 78
Joined: Mon Mar 07, 2016 12:35 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Changing Surface Skin in a 3D model????

Post by edypagaza »

i mean, during gameplay with acs
after a 3d zombie dies by fire, change his texture to a black one, i dont want to spawn a new actor as burned zombie
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Changing Surface Skin in a 3D model????

Post by ramon.dexter »

No need to involve acs at all. This could be done purely in modeldef.

So, lets say you have sprites for normal, like ZOMB A 0. Then, you have sprite for the burning death, something like ZOBD A 0. In this case you just have to define it like this in modeldef:

Code: Select all

model zombie {
//normal frames
        path "models/zombie/"
	model 0 "zombie.md3"
	skin 0 "zombie_normal.png"
        frameindex ZOMB A 0 0

//now the burning frames
        skin 0 "zombie_burned.png"
        frameindex ZOBD A 0 0
}
Basically, you have to re-define the skin before the burning frames, then define the actual frames and you're done.
User avatar
edypagaza
Posts: 78
Joined: Mon Mar 07, 2016 12:35 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Changing Surface Skin in a 3D model????

Post by edypagaza »

but without changing the frame, just the surface skin
User avatar
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

Re: Changing Surface Skin in a 3D model????

Post by Cherno »

Not possible. However, you might want to take a look at either Renderstyle (for pure black, use STYLE_Stencil along with black StencilColor), or a Translation that allows you to recolor the skin to give a burnt effect (my TRNSLATE entry is

Code: Select all

Burned = "0:255=#[70,44,29]"
)
Last edited by Cherno on Fri Aug 27, 2021 8:13 am, edited 1 time in total.
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Changing Surface Skin in a 3D model????

Post by ramon.dexter »

zheg wrote:but without changing the frame, just the surface skin
And how do you want to make a burned death without a frame? Sorry, but what you want is impossible.
User avatar
edypagaza
Posts: 78
Joined: Mon Mar 07, 2016 12:35 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Changing Surface Skin in a 3D model????

Post by edypagaza »

Cherno wrote:Not possible. However, you might want to take a look at either Renderstyle (for pure black, use STYLE_Stencil along with black StencilColor), or a Translation that allows you to recolor the skin to give a burnt effect (my TRNSLATE entry is

Code: Select all

Burned = "0:255=#[70,44,29]"
)
this is what i was looking for
i can change translation via acs
thanks
User avatar
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

Re: Changing Surface Skin in a 3D model????

Post by Cherno »

Can also be done in DECORATE/Zscript via A_SetTranslation.
User avatar
edypagaza
Posts: 78
Joined: Mon Mar 07, 2016 12:35 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Changing Surface Skin in a 3D model????

Post by edypagaza »

this is what i done with acs and a door
Moebius
Posts: 56
Joined: Thu Jan 28, 2021 1:45 am

Re: Changing Surface Skin in a 3D model????

Post by Moebius »

I'd like to piggyback on this thread.

I have a 3D model of a computer console with a monitor. The console uses three different Surfaceskins and the monitor uses a fourth. Using an 80 Script Line I want to trigger the monitor screen to change to another texture while a warning is played. I have a script that plays my sound when the script is run. I've been able to get the screen texture to swap using MODELDEF and DECORATE as below:

(But it's not what I want)
(How can I trigger the FrameIndex from A to B in the script?)
(is there something in DECORATE "Spawn" that can be triggered instead of on a time loop?)

Model monitor1
{
Path "Models"
Model 0 "monitor1.obj"
SurfaceSkin 0 0 "blinkyra.png"
SurfaceSkin 0 1 "strim.png"
SurfaceSkin 0 2 "cpmoxl1.png"
SurfaceSkin 0 3 "popprss1.png"
Scale 1.0 1.0 1.2
USEACTORPITCH
USEACTORROLL

FrameIndex MDCA A 0 0
SurfaceSkin 0 3 "popprss2.png"
FrameIndex MDCA B 0 0
}
=======================
ACTOR monitor1 15075
{
//$Category Models
//$Title monitor1
//$Color 3
Radius 16
Height 32
Mass 20
+SOLID
+NOGRAVITY
+DONTTHRUST
+NOBLOOD
States
{
Spawn:
MDCA A 30
MDCA B 30
Loop
}}
=============================
SCRIPT 3 (VOID)
{
PlaySound (157, "CPGSLKST", CHAN_BODY, 0.25, false, ATTN_NORM, false);
}
Moebius
Posts: 56
Joined: Thu Jan 28, 2021 1:45 am

Re: Changing Surface Skin in a 3D model????

Post by Moebius »

Nevermind All,

Found a thread right after I posted with a solution from Enjay. SwitchableDecoration solved my issue! Then just add Thing_Activate to the script. Changes monitor texture from one to the other.

Any one have something better?

ACTOR monitor1 : SwitchableDecoration 15075
{
//$Category Models
//$Title monitor1
//$Color 3
Radius 16
Height 32
Mass 20
+SOLID
+NOGRAVITY
+DONTTHRUST
+NOBLOOD
States
{
Spawn:
goto Inactive +1
Inactive:
MDCA A 1
MDCA B -1
Stop
Active:
MDCA A -1
MDCA B 1
Stop
}}
=======================
SCRIPT 3 (VOID)
{
PlaySound (157, "CPGSLKST", CHAN_BODY, 0.25, false, ATTN_NORM, false);
Thing_Activate (157);
}
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Changing Surface Skin in a 3D model????

Post by ramon.dexter »

Please, put the code where it belongs: into 'code' blocks...
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Changing Surface Skin in a 3D model????

Post by Enjay »

ramon.dexter wrote:Please, put the code where it belongs: into 'code' blocks...
Like this...

Code: Select all

ACTOR monitor1 : SwitchableDecoration 15075
{
	//$Category Models
	//$Title monitor1
	//$Color 3
	Radius 16
	Height 32
	Mass 20
	+SOLID
	+NOGRAVITY
	+DONTTHRUST
	+NOBLOOD
	States
	{
		Spawn:
		goto Inactive +1
		Inactive:
			MDCA A 1
			MDCA B -1
			Stop
		Active:
			MDCA A -1
			MDCA B 1
			Stop
}}
=======================
SCRIPT 3 (VOID)
{
	PlaySound (157, "CPGSLKST", CHAN_BODY, 0.25, false, ATTN_NORM, false);
	Thing_Activate (157);
}
Not absolutely essential, but it does help to make things more readable and avoid loss of formatting etc.
Moebius
Posts: 56
Joined: Thu Jan 28, 2021 1:45 am

Re: Changing Surface Skin in a 3D model????

Post by Moebius »

I don't post often and only after I scour the Forum for a possible solution. After 4 hours of looking I posted, only to find Enjay's solution minutes later.

Code: Select all

I will block my code in the future, I had problems posting images the first time tried.
Preview of the blocked code looks like the first time I tried images. Not sure If it's right.
Post Reply

Return to “Scripting”