0 registered members (),
1,382
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Unidirectional gouraud shading in the engine
[Re: ello]
#53149
08/30/05 16:10
08/30/05 16:10
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
I figured you would've needed that example as a guide. Using what you have given me to add, I get script errors. shademode = flat is not recognized by the engine. I can't find it in the manual either so perhaps you might have the wrong thing. Searching for "shade" didn't help either and "mode" gives a lot of unrelated results. The thing with "dot(normal, -vecSunDir)" is also giving me script errors. I figured that the hyphen in the front was causing it, but that didn't help. One of my other errors was because I forgot a semicolon, but that I fixed on my own. Here's what I'm up to right now:
shademode = flat; sun_light = 256; // some random number - don't know the impact of it sun_angle.pan = 0; // from due east - brightest on the east side of object sun_angle.tilt = 45; // half way from horizon to straight up - about 8:40 AM dot(normal, vecsundir);
Edit: Oh, as a reminder, this only needs to be applied just once each time a level loads and not be reprocessed every frame. Thanks.
Last edited by ulillillia; 08/30/05 16:11.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: Unidirectional gouraud shading in the engine
[Re: ChrisB]
#53151
08/30/05 20:38
08/30/05 20:38
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
Ah. I didn't know it was one of those things in an effect string. However, that still leaves the dot(normal, vecsundir) thing left. Is that, perhaps, a material effect?
Almost all my models don't have materials assigned to them, except to change the ambient color to 255 for all of them for true color (default is 200 for some odd reason). This, however, is that mat_model material, the global one. Most have only one action: my.dynamic = off;. This speeds up the frame rate as most of the objects are static, though few move.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: Unidirectional gouraud shading in the engine
[Re: ulillillia]
#53152
08/30/05 21:04
08/30/05 21:04
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
So, I tried adding the shademode = flat thing which IS better, but still not correct. The colors on the lighted sides are wrong and the lighting should be based on the angle of the surface not what I have here: That one odd block, the red one on the left in front, is how it should look. That's a block though and will later be replaced with a model, a start platform. Note that the other objects in the background have this bad white color and you can clearly see the polygons that make up the object. The polygons should, actually, be made of the same lighting when on the same plane (as with the block. The "normal" color you see is how they should appear at the brightest. For the darkest, it's like putting a half-transparent black object over it as with layers in GIMP. That's the concept I'm using in my 2D game (and the same basic sun angle as well where the brightest is on the top right and the darkest is on the bottom left. That red octagon-sphere above is how it should look like. This is only textured though and took about two hours to figure it out.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: Unidirectional gouraud shading in the engine
[Re: ulillillia]
#53153
09/02/05 12:09
09/02/05 12:09
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
One odd (and unusual) way of doing this, though I'm not sure if it'll work, is to have a light darken a texture. The light should be pure black (or 8, 8, 8 if 0, 0, 0 causes problems). The light should then darken everything it hits to half as bright. In the case of that octagon sphere (shown above), the light would be coming from the west and 45 degrees below the horizon. Anything, it hits, dependent strictly on the angle of the polygon, will get darkened and the head-on area (for the light) will be the darkest and the side on the opposite end will be completely unaffected by the light (true color). How do I do this?
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
|