shadow follow camera?!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
heroldini
Posts: 4
Joined: Mon Apr 11, 2016 4:13 pm

shadow follow camera?!

Post by heroldini »

hi,

i'm new in 3D-programming, and testing around with irrlicht 1.8.3
and i have some little problems, hope you guys can help me...
(ps: iam also relative new to OOP-programming)


first the smaller problem:
On Fullscreen mode, the "window" do not fill out the screen. On a other PC it does... why?
I think its a OS-side problem, right? - Run as admin, doesn't work, too...
Screenshot:
http://oi65.tinypic.com/ejy6ok.jpg


And the main problem:
well, my english is not the best for a good description, sry - but look at the video :P
you can see the shadows on the video. Parts of the tree's shadow following the camera node...
the tree is an animated mesh (its one of my first selfmodeled & animated - using blender - exported as *.ms3d).
The ground-squares and the red box in the Background is a simple *.obj file, it works perfect (its without boneanimation, of course).
Is it a bug, or do i something wrong...?
have a look at this video:
https://youtu.be/zbhVck1tBbY


Source:
http://pastebin.com/Fs0suhz2

sry for my bad english
thanks a lot :)
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: shadow follow camera?!

Post by CuteAlien »

Fullscreen on Linux is often tricky when the game-resolution doesn't fit the desktop resolution. Which Window manager are you using?

First workaround:
Compiling Irrlicht with _IRR_LINUX_X11_RANDR_ instead of _IRR_LINUX_X11_VIDMODE_ works better on some systems - but also has problems (it messes up the desktop on more windowmanagers when switching back to desktop). You can change it in IrrCompileConfig.h

Second workaround:
Set the resolution in the game which the desktop has.

Third workarond:
Like second you start by setting the resolution to the same as the desktop - but don't render your game directly to it. Instead render everything to a texture which can have whatever resolution you want. And then scale that texture to the desktop in a second step and render it to the screen. This is probably the technically best solution.

Second problem looks like your model is not closed. For the kind of shadows Irrlicht supports by default your models have to be closed (think of it like that - if you fill water inside none of it should drop out of the model).

edit: Here's some code which should get you the desktop resolution:

Code: Select all

 
IrrlichtDevice *dummyDevice = createDevice(video::EDT_NULL,core::dimension2d<u32>(100,100),false,false);    // dimension doesn't matter
if ( dummyDevice )
{
    video::IVideoModeList *videoModes = dummyDevice->getVideoModeList();
    core::dimension2d<u32> desktopRes = videoModes->getDesktopResolution();
    s32 desktopDepth = videoModes->getDesktopDepth();
 
    dummyDevice->closeDevice();
    dummyDevice->clearSystemMessages();
    dummyDevice->drop();
    dummyDevice = 0;
}
 
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
heroldini
Posts: 4
Joined: Mon Apr 11, 2016 4:13 pm

Re: shadow follow camera?!

Post by heroldini »

Hi,

Resolution problem:
On linux, i have it not tested yet...
using win7 64bit, for this experiments (btw win7 32bit on the other pc, where it worked)

i'm going to implement your third proposal later, i think thats the best way for different platforms...


Shadow problem:
yeah, you are right :)

For other users:
The Problem is, that i create many vertices for the tree's top.
To fix that in blender, mark all these vertices (use )
http://oi63.tinypic.com/10i7z9c.jpg
and click "Merge at center ([alt]+[m])"...
http://oi67.tinypic.com/11sjfjm.jpg


Thanks for your tips :)
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: shadow follow camera?!

Post by CuteAlien »

heroldini wrote: On linux, i have it not tested yet...
using win7 64bit, for this experiments (btw win7 32bit on the other pc, where it worked)
Oops - should have seen that in the screenshot :-) I assumed automatically Linux because that's where I generally see that kind of troubles. You might try as first step to check if the graphic-drivers on that system are up-to-date. Once in a while strange bugs happen simply because of drivers.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
niceguy4704
Posts: 3
Joined: Thu Apr 14, 2016 12:39 pm

Re: shadow follow camera?!

Post by niceguy4704 »

Thank you for the answer to this problem as I ran into it as well when trying to apply shadows to my huts in our course project for class. I cant make the huts solid as the player walks in and out of them. Is there any way of shadowing my huts, even if it means going outside Irrlicht??

I have a photo of the problem per request, but its the exact situation as the above person.

thank you for your time!
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: shadow follow camera?!

Post by CuteAlien »

Check XEffects (http://irrlicht.sourceforge.net/forum/v ... hp?t=30631), I think it has some shadow algorithms written with shaders. Can't help too much with that as I haven't used it yet myself.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
niceguy4704
Posts: 3
Joined: Thu Apr 14, 2016 12:39 pm

Re: shadow follow camera?!

Post by niceguy4704 »

Thank you for the response!

So I been playing with it since I posted, but needed to wait till someone posted so I didnt commit a double post.

I created a sphere .x file called tBall.x with a simple red material. The shadow does look correct, however 2 problems I noticed:

1. the shadow is calculated from camera position to the object, not my directional light (my sun) NOTE: sun is on the Y axis pointing to 0,0,0 and shadow is flowing to the -x axis away from 0,0,0

2. when I move the sun, with keystroke during runtime, the shadow doesnt change (it now does not change when I move the camera).

Thanks again! if anyone else has ideas, please share. again, snips are available on request.

Jeremy
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: shadow follow camera?!

Post by mongoose7 »

It may not work with directional lights. Try a distant point light instead.
niceguy4704
Posts: 3
Joined: Thu Apr 14, 2016 12:39 pm

Re: shadow follow camera?!

Post by niceguy4704 »

Thanks for the suggestion,


I downloaded the XEffect and added it to my project. I followed the example the Author provided, but I never was able to get shadows working in it. :cry:

for now I guess I will need to move on to the next stage of our project. I will try again in a couple days.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: shadow follow camera?!

Post by mongoose7 »

Post Reply