Giter VIP home page Giter VIP logo

grass.directx's People

Contributors

k-liu avatar mreinfurt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

grass.directx's Issues

Planning

This task is used to collect ideas and plan the next tasks.

Implement level of detail

Implement a level of detail in the geometry shader. The geometry shader can calculate the distance of the root point to the camera.

Then generate the grass blade depending on the distance... Something like:

if (distance < 20) 
{
  Create 10 vertices.
}
if (distance < 40)
{
  Create 8 vertices
}
and so on

Ideas

This issue collects ideas of stuff that we could implement at some point.

  • Real terrain (perlin noise) + grass correctly distributed (y position)
  • Post processing (Depth of Field / Fog)

Set up project

  • Create Visual Studio solution for DirectX MonoGame project and Content Pipeline

Improve geometry for grass blades

Currently, grass blades have 5 vertices:

  • 1 top
  • 2 middle
  • 2 bottom

Extend the grass blade geometry to have 8-10 vertices to have a nicer curve. Do not focus on performance/optimization right now, we can add a LoD modifier later.

Displace grass depending on terrain

After @k-liu created the terrain #17, use the height map information to pass it onto the grass shader. The grass shader should be able to displace the y position of the root depending on the xz position.

Randomize grass tint

Right now every grass blade has the same color due to using the same texture. However, in the real world grass blades have different saturation/tint due to them being younger/older and so on.

Therefore, offset the color by a randomly generated number. Some grass blades should be browner, some greener and so on.

Add rotation to grass blades

In the real world, blades are not all looking into the same direction. Add some variation using the randomized number in the geometry shader.

Add lighting

Add lighting for the grass shader.
Need to calculate normal for each vertex in the geometry shader.

The normal is calculated in the geometry shader by taking the three vertices and calculating their cross product

Taking the dot product of the normal by the light position achieves a per-pixel lighting effect.

This is only for basic lighting.

Wind

Implement basic wind using a wind vector field.

Add Alpha to Coverage

Right now, the texture is completely mapped to the grass blade and we're getting the "sharper edge on the top" because we only have 1 vertex there.

In the future, we should use a Alpha Texture so that the Texture is not fully a quad, but has a "blade" on the top.

Create grass patches

Instead of having one huge grid, create patches of grass that are laid out in a grid and draw them independently.

Improve level of detail

See explanation in Eddie Lees paper.

=> Find better distance values for each level of detail
=> Grass Patches further away from the camera have a smaller density.

Add configurable properties

While running the application, the following should be possible:

  • At the top of the application, a textual user interface should appear. It shows several (configurable) properties and how to change them. For example: "Grass width: 60 (Up: I, Down: K)"
  • Press F1 to show/hide the text UI
  • Press F2 to switch to grass texture
  • Press F3 to switch to wheat texture
  • Press F4 to reset camera
  • Press Arrow Up / Arrow down to control grass height

And maybe even more.
This should be done until the last appointment.

Improve plane

For now, we will not have real terrain with different heights. However, we should have a nice looking plane.

Therefore, do the following:

  • Make the plane a whole lot bigger (so the user does not see the end of it)
  • Make texture repeat itself. It's probably enough to set the UV of the left top point to 0.0 and the one of the left bottom to 0, 128
    • If needed, find/create a tileable texture. Does not necessarily have to be grass.

Planning

This issue will be used to plan our next steps. We do have milestones (which have the due date of the lab appointments), but in here we can discuss/write down the priority and order of things.

The issues do not necessarily have to be in chronological order. Basically, you can do whatever issue you want to do.

Paper content

  • Introduction with grass
  • Later moving from grass to wheat
    • Explain differences
  • Root point algorithm
  • Algorithm for generating the grass blade object (+ normals + UV)
  • Displacement because of terrain

Evaluate GUI

For changing vertex count, level of detail distance, light (position), texture, randomization factors...

Improve root randomization

Instead of generating an offset and "walking there", just generate a random value in between (start) and (end).

Create terrain using a HeightMap

  • Create a nice looking terrain Unity
  • Export HeightMap
  • Load HeightMap into our application and generate terrain
  • Calculate normals

Exchange skybox texture

We need something that looks like a nice autumn day. Warm and sunny, maybe a little bit darker.

Reduce flickering

There are several techniques that can be implemented to reduce the amount of flickering. There is a chapter "Flickering" in Eddie Liees Paper.

Basically we can:

  • Increase the thickness of each blade proprtional to the distance of the camera
  • Reduce patch density proportional to the distance of the camera
  • ...

Add post processing

Consider/Implement the following post processing techniques:

  • Fog
  • Depth of Field
  • Bloom

See Eddie Lees Paper

Create figures/pictures

For the paper, we need several images/figures explaining different stuff. This is a (not complete) list:

  • Density Map
  • Height Map
  • Root positions in a grid with patches
  • Generating blade algorithm (flowchart or something)
  • Grass field randomized + non-randomized
  • Chart with FPS comparison
  • Vertex displacement of wind
  • Picture of terrain + grass displacement
  • Picture with lots of aliasing / flickering
  • Picture with level of detail colors

Fix drawing order

when the grass is drawn before the terrain, the terrain gets messed up
would be nice if this was fixed, but that's polish!

Create wheat object

Create a real wheat object (using Blender or whatever). This can be a high poly model, as we will create a displacement map from it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.