PDA

View Full Version : Adding a light to a model?


Envid
August 28th, 2004, 10:01 PM
I understand that I have to give the model a sprite name for this to work, but im a little fuzzy on how to implement it. I checked dani's ded files and there are frame numbers on certain states. Im curious if he pulled them out of his head or he used an alternate program to find the exact frame number.

Vermil
August 29th, 2004, 01:20 AM
Indeed the frame field tells Dday what frame set of a sprite to show during that state.

Frame 0 = xxxxA
Frame 1 = xxxxB
Frame 2 = xxxxC etc

And if you want the sprite to be full bright in a state follow this numering

Frame 32768 = xxxxA
Frame 32769 = xxxxB
Frame 32770 = xxxxC etc

* Where "xxxx" is the name of the sprite that is entered in the sprite field.

For instance in the below example Dday is told to use the sprite set TROOAx for the state TROO_STND and the sprite set TROOBx lit up for the state TROO_STND2.

State {
ID = "TROO_STND";
Sprite = "TROO";
Frame = 0;
Tics = 10;
Action = "A_Look";
Next state = "TROO_STND2";
}

State {
ID = "TROO_STND2";
Sprite = "TROO";
Frame = 32769;
Tics = 10;
Action = "A_Look";
Next state = "TROO_STND";
}

Envid
August 29th, 2004, 01:29 AM
Yes i understand the concept, unfortunatley mixing sprite frames with model frames leads to unpredictable results if u were to mix the 2. Ive tried several different ways to accomplish the lighting on the model but Ive had issues where if the light is on, the model does not show up. Also with other experimentation, the sprite frames would cycle and then go to the next model frame which isnt helpful considering it didnt show my lights either.

The only successful time ive gotten the lights to actually work, the model would be in an infinite loop of sprite frames (model not shown during this period), or if i used only one frame the model wouldnt appear but the light would.

Lets just use this as an example.
Lets say I wanted a ball of light in the demon's hand through the move sequence. How can i accomplish showing the light as well as the model?

Remember the model is going through the movement sequence, so it needs opportunity to attack as well, not infinitley keep walking because of the NEXT state of a sprite.

Vermil
August 29th, 2004, 08:34 AM
Oh. Ok I thought you meant sprite states. Sorry.

Envid
August 29th, 2004, 11:47 AM
Oh. Ok I thought you meant sprite states. Sorry.

I thought I needed a sprite state to use a dynamic light. IE i had to name a SPRITE state in correspondance to the MODEL state.... maybe thats why they are conflicting hmmm... Ill figure it out later. Shame not many other people are familiar with this. Thanks for the info though, I didnt know what the higher frame ranges meant except for the DED reference at doomsdayhq. And it only labeled one of them.

Envid
August 31st, 2004, 04:37 PM
I thought I needed a sprite state to use a dynamic light. IE i had to name a SPRITE state in correspondance to the MODEL state.... maybe thats why they are conflicting hmmm... Ill figure it out later. Shame not many other people are familiar with this. Thanks for the info though, I didnt know what the higher frame ranges meant except for the DED reference at doomsdayhq. And it only labeled one of them.

bump..............

DaniJ
August 31st, 2004, 04:49 PM
Can you post your ded?

Envid
August 31st, 2004, 06:20 PM
well i was messing with ur ded dani to see if i could even put a light on the model. Just anything to show a light while the model was doing it's own AI.

Later i was going to fool with the placement of the light through the coordinate system and place the lightmap on top of it.

DaniJ
August 31st, 2004, 07:27 PM
To put a light on a model you need to make sure that the sprite frame used in the state your attaching the light too has the value n + 32768 (where n is the frame offset).

Envid
August 31st, 2004, 10:23 PM
ooOOooOOoooOOo Is there a way I can find a reference to specific frame offsets?

DaniJ
September 2nd, 2004, 11:41 AM
They are already in Objects.ded. If you want to add a light to a state that doesn't go fullbright you need to create a duplicate of the state (in your own ded) and then add the obove value to the frame number.

This has the side effect of making the model fullbright so in your model definition you need to set the flag:

flags= dim

If you don't want the model rendered full bright.