Comments (1)
@LML-566 the easiest option to include color in the models would be to make use of the property usemtl
that is available when defining a model in OBJ
format. This enables you to define a color (in hex format) for a specific set of faces.
As an example, see:
To get an idea of how the whole model would then look:
https://github.com/juangallostra/augmented-reality/blob/master/models/pirate-ship-fat.obj#L20
This is the easy part. You can search for models which already include color.
The hard part is that, after that, you should modify the section of the code that renders the faces of the model (see below) to render first (or not render at all) the faces that lie in the background according to the current perspective and then move forwards to render, as the last one, the face that lies most in the foreground. Otherwise you might end up seeing colors that are not expected to be seen.
augmented-reality/src/ar_main.py
Lines 106 to 120 in 19a49c4
I think (although I have not tested it) that it should be enough to order the list of faces to be rendered by decreasing y-coordinate. After computing the projection of the model vertices (Lines 113-114) for all the faces something along the lines of
ordered_faces = sorted(faces, key=lambda face: face[1], reverse=True)
should be done before rendering.
from augmented-reality.
Related Issues (20)
- I only get a random image being render everywhere with random sizes HOT 5
- How to detect the plane on the ground? HOT 1
- Track reference surface
- Add support for colored models
- Migrate to Python 3 HOT 1
- the 3d model not stable( flash of move always) HOT 1
- the 3d model not stable( flash of move always) HOT 1
- some error occured HOT 2
- How to display the texture of 3Dmodel? HOT 2
- Split requirements file
- why change the sign of homography matrix in function "projection_matrix"?
- An error occurred when running ar_main.py. How to resolve it HOT 1
- Hi, getting error of being unable to capture video HOT 4
- Standard size of the model image and video ? HOT 7
- Dimensions of a card HOT 3
- Size of loaded model and textures HOT 6
- Matching more than one object simultaneously HOT 5
- error: unrecognized arguments: HOT 2
- Is it possible to run it in web? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from augmented-reality.