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 / AGK shadow question

Author
Message
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 24th Sep 2018 18:22 Edited at: 24th Sep 2018 21:12
It seems like in my testing objects that do not receive a shadow still have their texture stages used up. Is this so? Or am I experiencing a different problem.

I have a ground terrain with 6 textures stages being used. When I set shadowmode to 3, my terrain is broke, even though I have it set to receive no shadows.

I have a plane directly above it set to be transparent, and receive shadows. I guess the shadows are transparent, because I am not seeing them. But I do see them if the object is set to not transparent.

Is this how its supposed to be?
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 24th Sep 2018 21:19
have you tried SetShadowMappingMode(3 )
fubar
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 24th Sep 2018 22:59
Yes, that is what I am using. I then make sure my terrain is set to not receive shadows. But then I seem to lose my textures on my terrain.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 24th Sep 2018 23:16
Strange is it possible to post an example of some code that shows the problem
perhaps a cut down version that people could try and test. Sometimes making a quick
example program can help show a problem and if it doesn't it may show a problem
where AppGameKit is not performing correctly

I need to go out for a while but il have a look at any code you post later when I get back
if you like
fubar
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 24th Sep 2018 23:33
I will try to get something together.
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 25th Sep 2018 12:08 Edited at: 25th Sep 2018 12:08
An example of what I am doing.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Sep 2018 13:13 Edited at: 25th Sep 2018 13:14
might be an idea to set SetShadowRange(-1 ) and SetShadowBias(0.001) while debugging

I notice both Objectplanes are the same size one I can see the positioning for but cant see
the others positioning is it possible they are overlapping or perhaps further down in the code
the objects are getting mixed up perhaps because home_grd and shadow_grd are not global


Quote: "You could try commenting out the other objectplane and see if that helps"
fubar
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 25th Sep 2018 13:17 Edited at: 25th Sep 2018 13:19
The other plane is not interfering. I have tried multiple things. Its just seems like when I set the shadow-mapping to mode 3 its overwrites texture stages 4-7 whether or not the object receives shadows. I am using shadow mode 2(mode 2 works ), since I do not use texture stage 7, and moving past this.

Another surprise is that invisible objects produce shadows.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Sep 2018 13:30 Edited at: 25th Sep 2018 13:31
If it works with mode 2 I cant see this an issue but was thinking perhaps the model is missing texture maps
or perhaps wrongly ordered

Quote: "Another surprise is that invisible objects produce shadows."

that sounds to me like a bug in AGK
fubar
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 25th Sep 2018 13:41
Mode 2 only uses texture stage 7 for the shadowmap. Mode 3 uses stages 4-7. So the shadow map is wiping out my assigned textures. I was hoping, that if the object wasn't set to receive any shadows this wouldn't happen. But, looks like its does it for all objects.
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 25th Sep 2018 15:08 Edited at: 25th Sep 2018 15:10
Talk to Janbo about this, he may have a solution.
edit: if you try SetObjectReceiveShadow( objID, mode ) to 0 for the terrain?
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 25th Sep 2018 19:07 Edited at: 25th Sep 2018 20:10
Yes, my terrain obj is home_grd and I use this: SetObjectReceiveShadow( home_grd, 0 )

Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 25th Sep 2018 20:14 Edited at: 25th Sep 2018 20:14
Random shadows that arise after level/area changes and shadows from invisible objects( I have no weapons equipped but you can see the shadows of all them ).


Attachments

Login to view attachments
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 25th Sep 2018 20:58 Edited at: 25th Sep 2018 21:13
...
puzzler2018
User Banned
Posted: 25th Sep 2018 22:31
turn off shadows for any destroyed objects?
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 26th Sep 2018 00:21 Edited at: 26th Sep 2018 00:24
I'll take half blame for the random shadows - the object was hidden but not deleted. My home level was not being deleted. I had added something new today, and of course introduced that nice bug.

I guess, I need to turn shadows off every time something goes invisible.
puzzler2018
User Banned
Posted: 26th Sep 2018 00:31
So we ok now
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 26th Sep 2018 01:30
Yeah, I am just using shadowmode 2, and I can handle the invisible stuff. Just annoyed lol
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 26th Sep 2018 11:20
It should not use the textures if you set the object up to not recieve shadows.
If I remember it, I'll look into it as soon as I get home.
No body should be forced to use shadow mode 2
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 26th Sep 2018 17:14 Edited at: 26th Sep 2018 17:15
Confirmed !
AGK writes into stage 4-7 even if SetObjectReceiveShadow is set to zero which I call a bug as it doesn't need to and screws with custom shaders.
I looked into the C++ code and I think you need to check if the object is allowed to draw to the textures cMesh::WantsShadows() in cMesh:;Draw() and maybe once again in AGKShader::MakeFinalShader(), but its to entangled for me to be sure now.
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 26th Sep 2018 17:31
Thanks for looking into it, Janbo.
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 28th Sep 2018 13:42
Quote: "I guess, I need to turn shadows off every time something goes invisible."


Just chiming in, but that's indeed what is required. As invisible objects can cast shadows if set up that way.

Quote: "I have a plane directly above it set to be transparent, and receive shadows. "


Why would you want to do that though? If your terrain is using a shader of sorts, it will need to have lighting added for shadows to work. Can't help with that though, as I've been mostly struggling passing anything from AppGameKit to shaders.
Did you add a high res texture to that plane by the way? Did you try using a box instead? I'm getting weird results when it comes to shadows on planes.
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 29th Sep 2018 01:27
I read that it increases performance. Maybe, it takes a custom shader. I dunno.

I have had no problems with shaders on planes.

Login to post a reply

Server time is: 2024-04-26 04:28:50
Your offset time is: 2024-04-26 04:28:50