1 registered members (TipmyPip),
18,633
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Adding Lights in SED
#227184
09/12/08 23:58
09/12/08 23:58
|
Joined: Aug 2008
Posts: 55 United Kingdom
CdeathJD
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2008
Posts: 55
United Kingdom
|
Ok my fetish for silly questions carries on, but my quest of the day is... how do you add lights to the world in SED? I mean like, dynamic-shadow-casting-lights as currently anything i create seems to have "r_fullbright 1" mode on!
I am a noob to this... Blitz3D is where i am best at!
|
|
|
Re: Adding Lights in SED
[Re: CdeathJD]
#227186
09/13/08 00:28
09/13/08 00:28
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Invisible lightsource ENTITY* lightsource = ent_create( NULL, vector(x,y,z), NULL); //create light point
lightsource.lightrange = greater_than_zero; //make it light up other stuff visible lightsource ENTITY* lightsource = ent_create( "lightbulb.mdl", vector(x,y,z), NULL); //create lightbulb
set(lightsource,LIGHT); //make it brightly lit
lightsource.lightrange = greater_than_zero; //make it light up other stuff
Color of light (both dynamic) is adjusted by entities red, green, blue properties. Dunno how to do spotlights yet sorry.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Adding Lights in SED
[Re: EvilSOB]
#227188
09/13/08 01:55
09/13/08 01:55
|
Joined: Aug 2008
Posts: 55 United Kingdom
CdeathJD
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2008
Posts: 55
United Kingdom
|
Thats good but in my level no shadows are cast!!! I've put the DYNAMIC CAST and SHADOW flags on for all entities, and the light in the picture is represented by a very badly drawn sprite! If anyone knows how to make sprites really spritish (always pointing at camera) and how to sort out additive blending on them that would be ace to know too, as the ones im stuck with are pretty crap! Thanks!
Last edited by CdeathJD; 09/13/08 01:58.
I am a noob to this... Blitz3D is where i am best at!
|
|
|
Re: Adding Lights in SED
[Re: CdeathJD]
#227191
09/13/08 02:28
09/13/08 02:28
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I'll look into the lighting.
In the meantime, To make sprites STAY facing the camera, set its pan & tilt to zero and leave them there. To additive blend sprites, play with its BRIGHT, TRANSLUCENT flags and its .alpha settings.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Adding Lights in SED
[Re: EvilSOB]
#227193
09/13/08 03:30
09/13/08 03:30
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Found the lighting issue. Create a new global material with MATERIAL* mat_dynamic =
{
ambient_blue = 20; //unlit brightness
ambient_green= 20; //unlit brightness
ambient_red = 20; //unlit brightness
emissive_blue = 200; //lit responsiveness
emissive_green= 200; //lit responsiveness
emissive_red = 200; //lit responsiveness
} and apply it to all the entities you want to be lit with dynamic lights. Attach the material like so ... ENTITY_NAME = ent_create(blah blah blah); ENTITY_NAME.material = mat_dynamic; ... This will get you started. Play with the material properties to learn more. Call the material whatever name you want.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Adding Lights in SED
[Re: EvilSOB]
#227224
09/13/08 11:09
09/13/08 11:09
|
Joined: Aug 2008
Posts: 55 United Kingdom
CdeathJD
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2008
Posts: 55
United Kingdom
|
I'll look into the lighting.
In the meantime, To make sprites STAY facing the camera, set its pan & tilt to zero and leave them there. To additive blend sprites, play with its BRIGHT, TRANSLUCENT flags and its .alpha settings. Yes i managed to get it working using d3d_alpharef = 255; its quite fait though! I also set the sprites pan and tilt to zero but it only follow the camera round in the x and y dimensions.... if i go above it it doesn't "look up" at me! I also implemented the material code as you suggested, but can't actually see any difference, and certainly no shadows drawn on the red landscape!
I am a noob to this... Blitz3D is where i am best at!
|
|
|
Re: Adding Lights in SED
[Re: CdeathJD]
#227347
09/13/08 21:37
09/13/08 21:37
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Damn, my bad again, for the blocks to cast shadows, each of the entities needs a set(EntityName,CAST); as well.
Are you using the new material on the terrain too? Cause you need to.
I'll look at the sprite rotation. Ive never tried going above before.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Adding Lights in SED
[Re: EvilSOB]
#227352
09/13/08 21:52
09/13/08 21:52
|
Joined: Aug 2008
Posts: 55 United Kingdom
CdeathJD
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2008
Posts: 55
United Kingdom
|
I'm using cast on all entities, but its not working. Unless i have to set each flag with a seperate command - i've been adding them up with the "|" operator.
I am a noob to this... Blitz3D is where i am best at!
|
|
|
Re: Adding Lights in SED
[Re: CdeathJD]
#227368
09/14/08 01:25
09/14/08 01:25
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Adding them with the '|' is ok, but Ive sometimes seen it not work if there is any spaces between the flag names and the '|'. eg VISIBLE|CAST = ok , VISIBLE_|_CAST = bad. But only sometimes...
You didnt clearly answer if you are setting the new material to the terrain too? (no shaders on the terrain I assume) And remember this is just for testing at this time.
Have the material changes youve done so far made ANY visual change? If so, what? (screencap?)
Havent got to looking at sprites yet. But check that they're pan,tilt & roll are all zero.
{EDIT} Done the checks, My bad again, has to be pan=0, tilt=0, and ROLL = 1 to get above alignment on sprite.
Also be aware, having an alpha channel in the texture of your entities, most commonly done by using TGA textures, causes lighting issues I cant explain, because I havent figured it out yet. Im leaving that Brainbuster for another day.
Last edited by EvilSOB; 09/14/08 07:16. Reason: Testing complete, awaiting further feedback
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Adding Lights in SED
[Re: EvilSOB]
#227526
09/14/08 20:53
09/14/08 20:53
|
Joined: Aug 2008
Posts: 55 United Kingdom
CdeathJD
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2008
Posts: 55
United Kingdom
|
Lol
* the entities dont use textures, * the landscape isn't a landscape just a flat cube, * the material makes no apparent changes. * i've removed spaces from between the SET flags
still no shadows!
BUT ON THE PLUS POINT!
the sprite trick worked!
But i was somewhat horrified to find that if you use more than 1000 entities (sprites) then the engine REALLY slows down, and if you can make it to 2000 then you dont seem to be in for a good framerate!
I am a noob to this... Blitz3D is where i am best at!
|
|
|
|