Giter Club home page Giter Club logo

obarry / aventura Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 10.62 MB

A lightweight 3D rendering engine 100% written in Java (no hardware dependency) and providing a java API to build world geometry, define graphic and rendering parameters and render the scene on any java application display.

License: MIT License

Java 100.00%
3d-engine rasterization rendering-3d-graphics texture-mapping 3d worldbuilding java vertex triangle-rasterization

aventura's People

Contributors

obarry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

aventura's Issues

Draw Lighting Vectors

It could be interesting to visualize the ligthing Vector(s) (there can be several Lights), an to center them to the origin. A context parameter could allow to set this option (not default).
This would allow to diagnose and investigate lighting.

Delegate view tasks to another class (e.g. RenderView) in RenderEngine

The RenderEngine should be abstracted from how translating (homogeneous) coordinates of triangles into the pixel coordinates of the view. This requires to create a class that performs this abstraction.
This can be a new class e.g. RenderView or to make View class more "intelligent". To be investigated.

Separate Specular Color from Ambient and Diffuse light

In current implementation the shaded color incorporates the specular reflection hence texture color is also multiplied with specular color however the right formula should be:

Color K = DTA + CDT + S = DT(A+C) + S
D: diffuse color, T: texture, A: Ambient color, C: color of the light source, S: Specular color

-> So the implementation should be modified to reflect the right formula and Specular Color should not be multiplied with Texture mapping color.

Separate triangles creation in World Element

Similarly to the normal calculation, we could separate the calculation of triangles in all Elements (a generic method can be proposed in the Element class that will need to be overriden in each Element).
This would allow to re-generate triangles at run-time of an application that, for example, would modify the structure of an Element, e.g. Trellis -> modifications of the altitudes to create a landscape -> need to regenerate the Triangles after creation of the initial default Trellis. Etc.

Whith Rendering type PLAIN the shading is opposite direction than Rendering type INTERPOLATE

To reproduce the issue, use the TestSphereTexture program and switch between the 2 Rendering types (disabling texture will show the result with even more evidence).
It is like the light would be at opposite direction.
Quick analysis shows that the switch between the 2 rendering types is in the method render() of RenderEngine class.
It is indicated that :
// Draw triangles with shading full face, no interpolation.
// This forces the mode to be normal at Triangle level even if the normals are at Vertex level
This likely means that the Triangle normals for the Sphere are opposite side than Vertex normals.
Is this a problem of normal calculation or Triangle orientation?
Is it a problem specific to Sphere?
To be investigated.

Draw Triangle normals

Create a context information to draw Triangle normals (in addition and separately from Vertex normals).
This should help to have a visual representation of all triangle normals.
Optionally the color of these triangles could be set (and by default it should be a different color than Vertex normals), and it could be e.g. YELLOW by default.

Refactor GraphicContext to contain only primitive types

The fact that the perspective Matrix is contained in GraphicContext leads to some complexity.
In particular while updating the context or creating a new context from one of the default contexts, this implies that the perspective Matrix is sometimes created multiple times.
This can be avoided by simplifying the context to only contain the elementary data (width, height, etc.) and delegating the creation of the matrix to other party TBD and to be investigated.

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.