Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / 3D objects have no shadow?

Author
Message
mindsclay
13
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 27th Dec 2013 04:10
Like, shouldn't I see shadow on a 3D object when I have a light in the scene? The faces that aren't lit should be in shadow. Not seeing it. I read that there is a default shader, so shouldn't that produce an actual 3D render.

I do not see any examples for any 3D code where there are shadows. Merely as box with no discernible edges... because there is no shadowing.

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
13
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 27th Dec 2013 04:53
Tried using several .vs and .ps code found in this forum and I still have no shadows.

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
13
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 27th Dec 2013 04:55
For those of you jonesing for the code:


www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 27th Dec 2013 05:30 Edited at: 27th Dec 2013 05:32
you forgot to use this: setobjectlightmode(objectnumber,1)

1 flag turns it on
0 turns it off

keep in mind that a flag set and not changed back will make every object created after that command with the same settings.
no vertex shader is required.
you also may need to modify the directional light settings for how you want it to look.

edit: also I don't think the point lights work....but I may be wrong.

mindsclay
13
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 27th Dec 2013 05:53
Thanks. I didn't that command. However, upon using it I am getting the same results.

And I am using a point light. Do I need to use a directional light as well?

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 27th Dec 2013 06:16
yup use a directional.....give me a sec and ill edit your code...

SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 27th Dec 2013 06:30 Edited at: 27th Dec 2013 06:31


and just make sure your setup file uses same resolution so it doesn't look chopped off


now just play with the light directional direction to get the correct shading you want

mindsclay
13
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 27th Dec 2013 06:52
Thanks.
I had already tried a directional light after I asked the question, and it worked. But why would a point light not work?

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 27th Dec 2013 07:44
I don't think it was ever finished coding.... I think tgc may have left that for v2??

mindsclay
13
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 28th Dec 2013 01:13
I am using the V2 beta

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th Jan 2014 17:26 Edited at: 11th Jan 2014 17:27
I'm also having problems with a directional light.

What I'm trying to achieve is a light that is sourced from "behind your right shoulder", casting down 45 degrees onto the scene, and 45 degrees to the left.

In the example image, the 2 walls should be almost equally lit? The main wall you see runs along the x axis. The one to the left runs along the Z axis.

The object in the middle should have reasonable lighting on the front of it, but it only has it to the left.

The shadow on the floor is fake, it's just a textured plane.
The texture on the object is a blue gradient from top to bottom. You can see the light on the rightmost curved edge.

My values for the shadow vector are -1,-1,1. The colour is 255,255,255.



Attachments

Login to view attachments
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th Jan 2014 18:05 Edited at: 11th Jan 2014 18:07
Here is another one with lighting that makes no sense.
I added 2 point lights, the white circles represent them in the image. They have no effect
The object in the centre is about 2.5 units wide.
I edited the directional light to be almost directly into the scene on the z-axis, hence the left wall is in more shade

One is directly in front of the object and has a radius of 100,000
One is against the left wall (0.2 units on front), red and a radius of 1,000,000
Lighting is on, otherwise the walls would be a speckled white colour



Attachments

Login to view attachments
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 11th Jan 2014 18:13
I don't think the point lights work yet.... just directional.


I may be wrong but I agree with you that they don't work.

Also the directional lighting stuff is a tad confusing as well.

oh... maybe the point lights work in v2? I seen tgc use them in there render to image example. maybe look and see what they have done to get them to work.

BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th Jan 2014 18:36 Edited at: 11th Jan 2014 18:36
Looky here. This is from above and behind. It almost seems like all lights always get a negative Z value no matter what you set, for position and direction

This is V1.18 by the way



Attachments

Login to view attachments
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 12th Jan 2014 00:26
oh....nice find!

BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Jan 2014 19:43
Having messed around a lot more the conclusion at this stage is:

1. Lights are positioned correctly, there was some error in my code somewhere in the last example above.

2. Directional lights work

3. Point lights don't work.

lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 14th Jan 2014 10:05
Did you have a directional light created when you tried point lights? Also, point lights have a maximum radius, so you have to scale the 3d for it.

Example I made a while ago included (feel free to use the shaders)

My hovercraft is full of eels

Attachments

Login to view attachments
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Jan 2014 11:53
That's excellent, thank you

I can't explain my point light dilemma, my scale is 1 unit to 1 metre, and the room is 10 metres wide. You are using a 20 unit plane and a 750 radius on the point light.

I'm just going to throw your shaders in and make it work, many thanks!

baxslash
Valued Member
Bronze Codemaster
18
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Jan 2014 12:20
Paul commented a while back on the radius of point lights being the inverse square of the falloff or some such nonsense. I haven't really used 3D much but I believe basically you need a much higher radius than you might think.

oct(31) = dec(25)
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 14th Jan 2014 12:36
Ah yes I remember that baxy. If I remember correctly it was a ** Constant-Linear-Quadratic Falloff ** (trademark)

lolz..

My hovercraft is full of eels
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Jan 2014 22:00
One more question. When you introduce your shader lights, do they automatically override the built in light shaders?

lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 14th Jan 2014 23:12 Edited at: 14th Jan 2014 23:19
Correct.

In effect, setting a specific shader (SetObjectShader) for an object would override the default shader which in turn is activated with "setObjectLightMode"

The problem with the default one, as you can see in the example, is that you need to have a directional light created for point lights to show up at all. And as you can see in the example the directional light is set to absolute zero (no direction, no color) but if you compare lighting with default shader and my (Paul's shader also really, I just.. fiddled) shader with only point light (shader-texture-pointlight.*); the object is brighter with the default shader even if you hold the point light to the side.

Thus, the directional light will always light an object slightly in the default shader.

My hovercraft is full of eels

Login to post a reply

Server time is: 2025-05-24 06:09:50
Your offset time is: 2025-05-24 06:09:50