color-changing objects

Questions and answers about the how and why of making maps.
Post Reply
User avatar
OO7
Private First Class
Private First Class
Posts: 113
Joined: Fri Aug 26, 2005 6:45 pm
Location: <classified>
Contact:

color-changing objects

Post by OO7 »

how would i make something such as a red-white blinking light?
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

Post by Winny »

use dynamic colors
dango
Private First Class
Private First Class
Posts: 1400
Joined: Sun Feb 06, 2005 5:40 pm
Location: Somewhere over there.

Post by dango »

Code: Select all

dynamicColor
name red_light
red sinsoid 1 5 0
end
don't forget to spell check it!
it makes the thingy you assign it to change from red to either alpha or black taking 5 seconds to go from black to red, i think
Image
User avatar
OO7
Private First Class
Private First Class
Posts: 113
Joined: Fri Aug 26, 2005 6:45 pm
Location: <classified>
Contact:

Post by OO7 »

once i have the dynamic color, how do i use it?
User avatar
ducatiwannabe
Private First Class
Private First Class
Posts: 3258
Joined: Tue Aug 10, 2004 3:55 pm
Location: Planet Earth
Contact:

Post by ducatiwannabe »

use dynamic colors
Try to be more descriptive when you give somebody help. Lots of answers to help are so vague it's like we think the person needing help already knows what he's asking for help on...no, don't take this wrong. I was just suggesting...

I don't really understand dynamic colors...but here's something that will blink different colors if you add it to your map.

dynamicColor
name flash
blue sinusoid 5 0 0.8
red sinusoid 7 0 0.8
green sinusoid 3 0 0.8
end

I used the mesh texture in a material.

material
name default
dyncol flash
texture mesh
color 1 1 1 1
end

Then to add it to a meshbox or anything all you do is.

meshbox
name blahblah
matref default
position 0 0 0
rotation 0
size 10 10 10
end
Last edited by ducatiwannabe on Wed Mar 15, 2006 1:08 am, edited 1 time in total.
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

Post by Winny »

I liek people to do research themselves ( im trying t do that too :P)
User avatar
Scorch
Private First Class
Private First Class
Posts: 747
Joined: Thu Sep 30, 2004 12:16 am

Post by Scorch »

Win Xp wrote:I like people to do research themselves
too bad...

The Dynamic Color object

dynamicColor
name example_dyncol

# there are 4 channels that can be modified:

# red, green, blue, alpha

# there are 5 types of commands per channel:

# limits, sinusoid, clampUp, clampDown, sequence

# except for "limits" and "sequence", the commands are repeatable

# if a sequence is used, then clampUps and clampDowns have no effect

# sequences can use three states (0, 1, 2).

# 0 - equivalent to an active clampDown

# 1 - equivalent to active clampUp and clampDown

# 2 - equivalent to an active clampUp

# if both clampUp and clampDown are active, the value is (min+max)/2

# the sinusoid function starts at the max value

# the sum of a channel's sinusoids is clamped between 0 and 1
red limits 0 1 # min/max limits
green sinusoid 0.1 0 0.25 # period, offset, weight
blue clampUp 0.1 0 0.75 # period, offset, width
alpha clampDown 0.2 0.5 0.5 # period, offset, width
red sequence 0.0 0.0 0 2 1 1 2 0 ... # period, offset, list of states
end
User avatar
OO7
Private First Class
Private First Class
Posts: 113
Joined: Fri Aug 26, 2005 6:45 pm
Location: <classified>
Contact:

Post by OO7 »

define "clampUp", "clampDown", and what the numbers in a sequence mean
User avatar
Scorch
Private First Class
Private First Class
Posts: 747
Joined: Thu Sep 30, 2004 12:16 am

Post by Scorch »

the sequence is the saturation value of thatcolor.

clampUP/DOWN = you know what a sinusoid is?...
User avatar
OO7
Private First Class
Private First Class
Posts: 113
Joined: Fri Aug 26, 2005 6:45 pm
Location: <classified>
Contact:

Post by OO7 »

not really, no


i can already hear you sighing...
User avatar
ducatiwannabe
Private First Class
Private First Class
Posts: 3258
Joined: Tue Aug 10, 2004 3:55 pm
Location: Planet Earth
Contact:

Post by ducatiwannabe »

He shouldn't be. We're supposed to be here to help.

Now, what exactly are you wanting to change colors? Could you post the coding for us? What colors do you want it to change? How fast do you want it to change? Every few seconds? 8)
User avatar
OO7
Private First Class
Private First Class
Posts: 113
Joined: Fri Aug 26, 2005 6:45 pm
Location: <classified>
Contact:

Post by OO7 »

sphere
name light
divisions 20 # number of subdivisions
flatshading # flat shading (smooth is default)
position 0.0 0.0 1114.0
size 2 2 2
radius 10 # sets all size values to this value
shift 0 0 0 #(repeatable)
scale 1 1 1 #(repeatable)
shear 0 0 0 #(repeatable)
smoothbounce # ricochets use normals
end

i want this to flash red on and off, like a light you see on a tower.
on for 1 second, off for 5
dango
Private First Class
Private First Class
Posts: 1400
Joined: Sun Feb 06, 2005 5:40 pm
Location: Somewhere over there.

Post by dango »

Code: Select all

dynamicColor 
  name flash
  red sinusoid 0.1 0 0.25
end 

sphere
name light
divisions 20
flatshading
position 0.0 0.0 1114.0
size 2 2 2
radius 10
smoothbounce
dynCol flash
end 
Image
User avatar
OO7
Private First Class
Private First Class
Posts: 113
Joined: Fri Aug 26, 2005 6:45 pm
Location: <classified>
Contact:

Post by OO7 »

1. radius needs to be 2
2. it dont work, not when i try adding a transparent tex, nothing. i just get a sphere with a slight flash.
just go look at it, the servers up
dango
Private First Class
Private First Class
Posts: 1400
Joined: Sun Feb 06, 2005 5:40 pm
Location: Somewhere over there.

Post by dango »

1: if the radius needs to be 2, then why did your first code have a radius of 10?
2: I forget how to make it go from transparent to red.
Image
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

Code: Select all

dynamicColor
	name flash
	blue sinusoid 2 0 1
	green sinusoid 2 0 1
	alpha sinusoid 2 1 0.6
end


material
	name light
	dyncol flash
end
This code makes the material go from clear to red with 2 second period. Notice the color red does not use the sinusoid function (keyword). Basically you're turning on and off the other colors. And the alpha channel has a one second offset.
User avatar
TD-Linux
Sergeant
Sergeant
Posts: 724
Joined: Wed Apr 27, 2005 8:26 pm
Location: Mountain View, CA

Post by TD-Linux »

anomaly is right on!

I can contribute a little to dyncolors... all I know is about sinusoids.

sinusoid 0.1 0 0.25 # period, offset, weight

Period: speed. How long it takes the channel to go from 0 to 1 and back, I think.

Offset: Not exactly sure, I think it is how many seconds offset the sinusoid is relative to a sinusoid with an offset of 0. I always leave it at 0 except for complex effects. Maybe it is the difference between the time it is 0 and the time it is 1?

Weight: I think this is the time spent at 0 or 1.... the higher, the quicker the transition. Or maybe the slower. I forget.

I messed with dyncolors a long time ago (relatively) and have forgotten most of the stuff I figured out.

There should be a dyncolor wiki!
User avatar
OO7
Private First Class
Private First Class
Posts: 113
Joined: Fri Aug 26, 2005 6:45 pm
Location: <classified>
Contact:

Post by OO7 »

thx that works
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

The offset affects the start time. Add the offset to the start time in other words. Thats why the alpha channel offset is half the period of the color channels in my original post. Alpha channel starts swinging towards transparent after the color channels have reached max. Otherwise the colors would go transparent at the same time they reached their max (saturated) values. That would cause the color to not be seen very well. Probably not what most of us want to achieve. Think of the time period of a sine wave (sinusoid). Thats probably how the equations are done in the code. I haven't looked at the code to find out though. Maybe later.
Post Reply