Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,382 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Unidirectional gouraud shading in the engine [Re: ello] #53147
08/30/05 13:29
08/30/05 13:29
Joined: Mar 2003
Posts: 1,524
Canada
Stansmedia Offline
Serious User
Stansmedia  Offline
Serious User

Joined: Mar 2003
Posts: 1,524
Canada
Quote:

i once did a nice lighting situation, maybe thats what you are talking about.
heck this: http://www.earthcontrol.de/downloads/katakomben/katakomben.zip out, the global lighting always comes from the same side, no matter where you look at.




Thats really cool ello.


Decessus - 80% done. 100% abandoned.
GET MY ANDROID GAME! https://play.google.com/store/apps/details?id=com.lasertrain.zspinballfree&hl=en
Re: Unidirectional gouraud shading in the engine [Re: ulillillia] #53148
08/30/05 13:36
08/30/05 13:36
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
ok, i got you..

you need to apply ShadeMode=flat; to the objects. additional you can calculate the lighting using dot(normal,-vecSunDir); just as a point into the direction.

thanks, kris:) i like it pretty much, too

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 Offline OP
Senior Expert
ulillillia  Offline 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: ulillillia] #53150
08/30/05 19:25
08/30/05 19:25
Joined: Sep 2002
Posts: 1,604
Deutschland
ChrisB Offline
Serious User
ChrisB  Offline
Serious User

Joined: Sep 2002
Posts: 1,604
Deutschland
Code:
 
material mat_model
{
effect="
technique hardedge{
pass p0{
ShadeMode=flat;
}
}";
}



This overrides the shading of all models (if they have not other materials).


www.Swollen-Eyeballs.org
ICQ:169213431
#3dgs@quakenet
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 Offline OP
Senior Expert
ulillillia  Offline 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 Offline OP
Senior Expert
ulillillia  Offline 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 Offline OP
Senior Expert
ulillillia  Offline 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
Page 2 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1