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.

DarkBASIC Professional Discussion / Strange backwards shadow shading (only on 1 of our models)

Author
Message
C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 2nd Jun 2010 17:00 Edited at: 2nd Jun 2010 19:41
Ok we're trying to use shadow shading in our game but for some reason, on 1 of the 3 cars, the shadow is backwards...
(Ignore the wheels, they are separate objects with their own shadow shading)

Screenshot:


What causes this and how can we fix it?
(It works fine on the other 2 cars, which were made in Deled, but this car was made in C4D.)

EDIT:

Also for no apparent reason, on this car alone, the back left wheel is ignoring commands to use shadow shading. - Which is odd because the back left wheel is exactly the same model as the back right wheel which is accepting shadow shading.

Code for back left wheel:


Code for back right wheel:

Now, I've tried importing and exporting the car body through Deled and that sorts out the shadow shading takes out the part to automatically load the texture. I tried this with the back wheel model to see if that would fix it too, but no, strangely enough the back left wheel still doesn't have a shadow. :S



For anyone who wants to see this game for themselves please download it from:
http://www.soharix.homestead.com/World_Off_Road.rar
The car in question is called Rumbler and was made by Blobby 101

Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 2nd Jun 2010 17:26
The model has inverted vertexes. I'm not familiar with 3DWS but maybe the car body is scaled with a negative value sometime in the modeling process? Seems the front wheels are inverted also?
Try doing "Scale Object ID, 100,-100,100" to invert it in code and see if that works. Then if other shadows become inverted instead then you have to look over the model.

Similar problem here.
http://forum.thegamecreators.com/?m=forum_view&t=165545&b=1
Although my particular problem with Blender exporting is now fixed with Kira's exporter so the shaderfix is no longer needed, nor valid for you as the other models work.

Regards
C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 2nd Jun 2010 17:33 Edited at: 2nd Jun 2010 17:34
Nope I'm afraid flipping the polygons on everything not only turns everything inside out, but it also messes up the Dark Physics attachments and still doesn't solve any problems xD.

Screenshot:


Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 2nd Jun 2010 18:04 Edited at: 2nd Jun 2010 18:23
Omg i see in the first picture now what you mean. The shadow is not inverted as in holes become shadows and solid become nonshadow projected. It is front to back but the shadow works. It is as if the car body is attached the other way .

Do a test, only load the car body and do shadow shading only on that, no physics or wheels and no rotation after it loads.

The left wheel is peculiar though. It the same object as the right back only rotated? You don't use any Glue Object to attach it or anything? The PD joint commands should not invert it either.

Edit: i did the same test, looks ok. So must be some rotation problem in the code.



Regards
C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 2nd Jun 2010 19:26 Edited at: 2nd Jun 2010 19:46
Well, I mean, here's the code for loading the body:

(Exactly the same as all the rest bar the scaling)
Then in the main loop I'm doing:

(OBJ+5 is object 8 as OBJ=3)

So I really don't see what it's doing xD

EDIT:
Ok we solved the body problem, just needed reexporting from another program and it was fixed.

We tried the same thing to fix the back left wheel but nope, it's still hidden for no apparent reason xD

Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 2nd Jun 2010 23:14 Edited at: 2nd Jun 2010 23:16
Just realized you could change the view with the mouse
Could not see before but now i see all the shadows. And i have both rear wheel shadows?



Only the body is reversed.
C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 3rd Jun 2010 02:17
Well that "is" weird.

xD

We were just kinda of the mind to leave that random back left wheel bug alone, as it only happens on 1 car, and only to me apparently. xD

Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 3rd Jun 2010 11:21 Edited at: 3rd Jun 2010 11:22
Didn't see your post with the body code last night but...

There's your problem!
"Set Object Normals 8"




Regards
C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 3rd Jun 2010 18:58
Oh, I was sure I tried taking that out and it didn't affect the original model. But still, we've solved that one now and are more worried about that wheel xD.

C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 12th Jun 2010 03:07 Edited at: 12th Jun 2010 03:10
Ok well, after we established it only seems to happen on my computer.

I have now just established it was only that particular map.

As, using Rumbler on the new map I just created allows all 4 wheels to be shadow shaded. So, I don't know xD


Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 12th Jun 2010 03:17
Sounds good

You should also use the shadow shading in shader mode for performance
As you use PhysX you can determine people running the game will use pretty modern graphics cards.

From the help files:
SHADOW SHADING ON Object Number, Mesh Number, Shadow Range, Use Shader

If ShadowMesh = 0 // i.e no special shadowmesh created for this object
ShadowMesh = -1
endif
SET SHADOW SHADING ON ObjectNo, ShadowMesh, Range, 1

Regards
C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 12th Jun 2010 03:38 Edited at: 12th Jun 2010 04:39
@ Duke E
Thanks for that Not that I personally will be using it but if I set shadows on cars and props, as it is in the tech example, I get an FPS of 39 with just set shadow shading on but with your code (adding ,-1,50,1 to the end) it goes up to 46.

Now, I say I won't use it because I turn anything off that takes my FPS below 66, but I will leave it in for the car shadowing as it is bound to boost performance on other PCs, and for the inevitability of graphics options, it will again help boost performance for those who can run shadows on props and cars simultaneously.

As for me, I'll just stick with rendering 100k polys, water and shadows on cars.

Thanks again.

Login to post a reply

Server time is: 2026-07-25 16:41:16
Your offset time is: 2026-07-25 16:41:16