Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (steyr, alibaba), 534 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
light on blocks vs. model #330955
07/01/10 08:40
07/01/10 08:40

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



this way blocks are lighted:




this way models are lighted:

.


Is there a way I can create the same smooth lighting (as with blocks) with models?

Re: light on blocks vs. model [Re: ] #330957
07/01/10 09:00
07/01/10 09:00
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline
Senior Member
Razoron  Offline
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
Definatly blocks. Models use vertex lightning.

Re: light on blocks vs. model [Re: ] #330958
07/01/10 09:06
07/01/10 09:06
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
You can increase the number of polygons of the model, or you can use shader for models.

Re: light on blocks vs. model [Re: Emre] #330960
07/01/10 09:12
07/01/10 09:12

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



"use shader for models"

which shader I can use to get this smooth lighting on models?

Re: light on blocks vs. model [Re: ] #330963
07/01/10 09:40
07/01/10 09:40
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
for example specular.
without shader;

with shader;

but you may need a little increase the number of polygons of the model anyway wink

Re: light on blocks vs. model [Re: Emre] #331080
07/01/10 20:11
07/01/10 20:11

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



Looks good but gloss.
Is this a side effect of the specular shader?
(I need a dull look (on my sand texture))

Re: light on blocks vs. model [Re: ] #331087
07/01/10 20:39
07/01/10 20:39
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Per pixel diffuse shading and attenuation should do the job for you.
This means nothing else, but that you have to put the vertices position and normal into texcoord registers:

Code:
Out.worldpos = mul(inPos, matWorld);
Out.normal = mul(inNormal, matWorld);



They will automatically be interpolated for each pixel and you can read that interpolated pixel out in the pixel shader.
The shading itself is usually calculated based on Lambert's cosine law:
Code:
In.normal = normalize(In.normal);
float3 lightdir = normalize(In.worldpos.xyz-vecLightPos[0].xyz); //I tend to do this the wrong way around, so you may have to substract the other way around
float3 diffuse = saturate(dot(In.normal, lightdir))*vecLightColor[0].rgb;



For information on the attenuation, check out Hummels post here: Attenuation

The final formula is color*(ambient+diffuse*attenuation).

I once put some shader base code on my blog. Just take it and insert the formulas from above: Blog entry

This is actually quite simple, so probably a good possibility for you to get a bit into shaders? laugh

Last edited by Slin; 07/01/10 21:03.
Re: light on blocks vs. model [Re: Slin] #331125
07/02/10 06:37
07/02/10 06:37

M
mercuryus OP
Unregistered
mercuryus OP
Unregistered
M



Thanx!
I'll give it a try.
I always tried not to use (understand) shader but maybe it's time to.
(do you know a good tutorial (e.g. "Shader for dummies")?)

Re: light on blocks vs. model [Re: ] #331144
07/02/10 08:10
07/02/10 08:10
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
slins blog posts?


3333333333
Re: light on blocks vs. model [Re: Quad] #331165
07/02/10 10:57
07/02/10 10:57
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir

Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

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