Page 1 of 1

(REALIZED IDEA) Equipped torch casts shadows same as the spell "Light"

Posted: Fri Nov 27, 2020 9:38 pm
by King of Worms
So when I cast a "light" spell, the light produced casts shadows all around including the world geometry (like walls) and I like that.
01.jpg
01.jpg (366.77 KiB) Viewed 2560 times
When I equip my torch, the light casts shadows from sprites, but not from world geometry.

Is it possible to change that?

It could be either a option in the game (Torch casts geometry shadows ON/OFF)

OR

A mod script ppl can use. Id like to include such script in my DREAM mod, it would be great!

Also, a detail. When you cast "light" the light source is kind of moving and that makes the shadows jump around.
This effect is too strong. But if it was reduced to 50 or 25% it could produce realistic torch light, because that light is not 100% static in real life neither.

Thanks a lot for consideration :)

Re: IDEA: Equipped torch casts shadows same as the spell "Light"

Posted: Mon Feb 01, 2021 4:21 pm
by Hazelnut
Hmm, I can't believe I never noticed that! :)

Not sure how to enable this, but i will try.

Re: IDEA: Equipped torch casts shadows same as the spell "Light"

Posted: Tue Feb 02, 2021 7:34 am
by King of Worms
Hazelnut wrote: Mon Feb 01, 2021 4:21 pm Hmm, I can't believe I never noticed that! :)

Not sure how to enable this, but i will try.
Great 😊

Re: IDEA: Equipped torch casts shadows same as the spell "Light"

Posted: Tue Feb 02, 2021 7:56 am
by Ralzar
Oh wow, I always felt that the light spell was more atmospheric, but I never knew quite WHY until now :D

Re: IDEA: Equipped torch casts shadows same as the spell "Light"

Posted: Tue Feb 02, 2021 8:08 pm
by Hazelnut
So having taken a look into this, I actually did notice this at the time but after reading your post didn't put 2 & 2 together until looking inside unity tonight.

The player torch does cast shadows off the static geometry, but due to it's position relative to the player camera you don't really see them. Basically the relative positions of the torch light and the camera ensure they are rarely visible.

The magic candle on the other hand floats in front of the player so it's much easier to get cast shadows like in your picture.

What I've done is to offset the player torch light source game object if item based player torch is active - I don't want to affect the normal player light at all. It's slightly forward and to the left as well as a bit higher.

Code: Select all

torchLight.transform.position = new Vector3(-0.3f, 1.2f, 0.2f);
This simulates holding torch in left hand, slightly to left and forward, as well as above the eyeline. Lets not get into how this would work for 2h weapons, bows and shields etc.

So now you'd see shadows but only from left/above. See example:

torchBefore.JPG
torchBefore.JPG (94.83 KiB) Viewed 2383 times
torchAfter.JPG
torchAfter.JPG (96.3 KiB) Viewed 2383 times

Re: IDEA: Equipped torch casts shadows same as the spell "Light"

Posted: Tue Feb 02, 2021 8:27 pm
by l3lessed
Beautiful job. Looks more realistic. Technically, if someone wants to give me a good enough sprite set for a animated torch being held, I could add it into the FPS render system in ambidexterity so torches show being held.

As for two handed weapons, I thought about this some. I plan on hitting this after first release of my ambidexterity mod. It wouldn't be hard to shift the idle sprite offsets for two-handed weapons, so they are positioned more center or center left to signal visually two-handed stances. Add a quick pull down/back animation (or not), and then run normal attacks. Same with small blades; I plan on resizing them to reflect blade size better.

Re: IDEA: Equipped torch casts shadows same as the spell "Light"

Posted: Tue Feb 02, 2021 10:16 pm
by King of Worms
Great job Hazelnut 😊 in my mind I always imagined holding the torch in my right hand, eventho it makes no sense as there is usually a weapon (but with 2h it doesnt make sense in either hand and its no problem as well) I just hope this change will not trigger my ocd about it 😂 I think I will test it and hope for the best indeed. Will report back asap. Left/right switch in options would be nice, but the options are already full basically..

I can try to provide the animated sprites based on ingame art 3lessed... question is, in which hand it will be held 😂

Re: IDEA: Equipped torch casts shadows same as the spell "Light"

Posted: Wed Feb 10, 2021 8:12 am
by l3lessed
Ha king. If I had art for each hand, I could possibly add it as an option to the mod to have torch switch hands or disappear on duel wield. Or I can code flip the art myself, as I have done for weapons and animation smoothing. It is just harder than loading a new sprite.

Still plan on dream patches in near future. Once wrap up this final test release of smooth animations to ambidexterity module, I will work on patching it for Dream weapons, and the dream shields you gave me.

Re: IDEA: Equipped torch casts shadows same as the spell "Light"

Posted: Sun May 02, 2021 6:12 pm
by King of Worms
Completely forgot about the 1st person handheld torch - will add it to my notes.