Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Computer Graphics Final Project - Paradise: Forest and Water Simulation

NotificationsYou must be signed in to change notification settings

debowin/paradise-gl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Computer Graphics Final Project - Paradise: Forest and Water Simulation. Inspired by the wonderful tutorial serieshttps://www.youtube.com/playlist?list=PLRIWtICgwaX23jiqVByUs0bqhnalNTNZh by ThinMatrix with several additions of my own.

Setup Instructions

  • Add the JARs under lib/jars to your project's libraries. This includes LWJGL, SlickUtils and PNGDecoder.
  • Add-Djava.library.path=lib/natives/ to your JVM options while building.
  • IMPORTANT - The native link libraries included are for Linux distributions.For other platforms, you'll need to download them separately fromhere.
  • If you have any trouble running this, shoot me anemail.

Snapshots

Nature's Beauty

showcaseJust an aesthetic shot of our scene.

Fake Lighting(Lamp) & Transparent Textures (Pine, Fern)

fake_lighting

  • We can fully see through parts of the Fern's and Pine's leaves.
  • We've lit up the lamp as if it were the source of the light.
Fogging, Skybox, Multi-Textured Terrain, Texture Atlases (Bob, Fern)

fogging_skybox

  • Distant trees and plateaus appear hazed in the fog.
  • The cloudy sky spans all over the forest.
  • The terrain has multiple surfaces - grassy, dirt, path, flower patches.
  • There are trees and ferns with different colors.
Water Reflections - Fresnel Effect

reflectionsMore reflection if you view the water from the side.

Water Refractions - Fresnel Effect

refractionsMore refraction through the water surface if you see it from the top.

SIMULATION VIDEO

video_snap

CONTROLS

InputAction
WMove Forward
SMove Backward
ATurn Left
DTurn Right
QMove Upward
EMove Downward
FToggle Full Screen
Spacex3 Boost Move Speed
Mouse WheelZoom In/Out
Mouse Left Click & DragRotate Camera
Mouse Right ClickRestore Camera

Objective

The aim of the project is to render a simulation of a scene consisting of a forest containing a lake using the modern OpenGL pipeline.

Group Members

  • Debojeet Chatterjee
  • Ameya Gurjar

Project Description

We're using the Light-Weight Java Game Library for this project to try out a different style of OpenGL programming and also, since using Java allows us to package and structure a larger codebase more easily in a purely Object Oriented manner.In this project, you navigate your ship in 3rd-Person through a beautiful hilly forest area full of different kinds of trees, ferns, lamps and a lake.

Forest Simulation

  • We have supportedTransparent Textures to render ferns and pine trees to let us completely see through areas where the alpha of the texture is less than 0.5
  • We're also mixing between the sky colour and the terrain as well as model texture color to haze distant models and terrains exponentially to achieve a fogging effect.
  • In addition, we areMulti-Texturing the terrain using aBlend Map to blend between 4 different textures based on the R, G, B components.
  • We’ve added aSkybox using a GLSL samplerCube that moves with the player for realism.
  • We’ve usedTexture Atlases for some models so that we can re-use the same model with different looks using only one texture file.
  • We’ve used aHeight Map to make the terrain uneven with hills and troughs.

Water Simulation

  • The water body is simply a flatquad made up of two triangles.
  • The quad is textured so that it looks like a water body. A combination of reflection texture and refraction texture is used. This makes use ofFrame Buffer Objects.
  • Both textures need to be clipped using aClipping Plane at the height of the water surface quad to only render what is necessary.
  • Projective Texturing is used to texture the water surface to make the water reflect and refract based on the position of the camera relative to the water.
  • The two textures are mixed using theFresnel Effect. This is achieved by the simple formula for refractivity = max(dot(water_normal, view_direction), 0). A higher value results in less reflectivity.
  • To make it look like the water is rippling, we add some distortion to the surface of the water according to aDuDv Map. We also change the distortion with respect to time for realistic effect.
  • ANormal Map that corresponds to the DuDv map is used for uneven specular highlights on the surface of the water based on the ripples.

Challenges Faced:

  • To avoid player-terrain collision as we didn’t want the player to collide with the terrain and go through it,we added checks to make sure the player’s ship is always some distance above the terrain. This was trickier when we added the water surface but we used a similar technique for a buoyant effect.
  • To ensure that none of the randomly generated entities were rendered on the water surface. We wrote a function to determine if a particular position vec3 is underwater. This came into use in the above problem as well.
  • We wanted torandomly generate and place a large amount of foliage on the map. For this, we used an optimised approach to load a multitude of instanced entities by loading their corresponding textures only once before rendering them.
  • Fake Lighting i.e setting all object normals to point upward lets us light up the lamp and nearby area realistically with just an overhead point light.
  • To make the distortion in the water look realistic. For this we sampled the DuDv map multiple times and each time we changed the offset in a different way and combined their effects so that the distortion in the water would look natural.
  • Finally, as a by-product of the distortion we add in the water, we get some glitches on the edges of the water body. We make use of the refraction depth texture and soften the edges of the water surface usingAlpha Blending.

Connections to Class:

Even though our goal here was to learn a lot of concepts outside of our class curriculum through implementation, we did usea number of concepts that we were taught in class.

  • We used theFresnel Effect in rendering the surface of the water naturally. The reflectance of the water changes according to the viewing direction.
  • We’ve added a time-based distortion to the surface of the water which is related totime-based animation.
  • The edges of the water surface are soft which is implemented usingAlpha Blending and transparency.
  • Using theGraphics Pipeline(model, view, projection matrices).
  • Using point lights which uses the concept ofLocal Illumination with three term quadratic falloff.
  • We use thePhong Lighting Model with Blinn-Phong specular highlights to light up our entire scene.

Future Enhancements

  • Audio Effects.
  • EntityCollision with Player.
  • Particle Effects for flowing water, fountains, waterfalls and other natural phenomenon.
  • Deferred Rendering could let us include a lot more lamps and let us have a beautiful Night scene.
  • Shadow Maps andEntity Normal Maps.

[8]ページ先頭

©2009-2025 Movatter.jp