Saturday, January 9, 2021

Dynamic Environment (WIP)

As a Tech Artist, I want to be able to enhance concept art, so for my 2020 Tech Art final, I began creating a dynamic environment in Unity.  This project is still a work in progress as I learn to enhance and refine my work.
Currently I have a Day/Night Cycle in place, using a directional light for the sun and a point light for the moon.  

The position of the moon is calculated using the 2D rotational formula which utilizes sine and cosine to rotate a “point” around unit circle. *hit play* This is then modified by a scalar value (customizable by the user) to set the distance of the moon from the scene’s origin.  
The sun is simply rotated about the x-axis. Currently the duration of the day is a 24-hour/24-second day, making the rotation angle 15 degrees (360 / 24).


The dot product is used to increment the light intensity of the moon and sun as they head towards their apex, then decrementing them as they reach the horizon. It is also used to set the sun’s color gradient (to simulate sunrise/sunset).

I also wanted the sprites to cast and receive shadows, so through research I discovered that this could be accomplished by 1) turning on the ability of the sprites to cast and receive two-sided shadows via a small script, and 2) writing a shader that allows shadows to be cast and received.  I also added the ability to take normal map information to make the 2D art respond to the light. 

<video here>

I also have a particle effect in place to simulate rain in the environment.  I plan to make the rain volumetric instead of 2D and add in effects such as clouds and lightning to improve the feel of the storm.

<video here>

This is just a static test scene, and while I’d like to build it up more (though I certainly enjoyed making an homage to the classic Disney cartoon The Gummi Bears), what I would really like to do is be able to take these tools and implement them in an animated 2D scrolling scene.

This image is from a scene I made and animated in Photoshop and Premier and posted previously in this blog. The interior is currently static, while different assets pass by in the background. I would like to take this to unity, implement parallax scrolling, and figure out how to utilize the lighting and effects I’ve created as seen through a train window.



The shader used to create my normal maps and 2D shadows was inspired from shaders created by anlev on github and WrongTarget on the Unity forums. 


No comments:

Post a Comment

Search This Blog