Comments (14)
It would make it more clear what's happening as instanced color is multiplied by base color.
I call it tint in glsl anyway https://github.com/pex-gl/pex-renderer/blob/master/glsl/PBR.frag#L1411
from pex-renderer.
currently we have
renderer.geometry({
positions: [],
normals: [],
vertexColors: []
offsets: { data: [], divisor: 1 },
colors: { data: [], divisor: 1 }
})
renderer.geometry({
positions: [],
normals: [],
colors: []
offsets: { data: [], divisor: 1 },
tints: { data: [], divisor: 1 }
})
from pex-renderer.
Another reason to use colors
not vertexColors
is glTF vertex color attribute is named COLOR_0
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#meshes
from pex-renderer.
Added this to 3.0.0 milestone as it's breaking and we change it now or never..
Still undecided on the tints
name though. Probably better than instanceColors
though.
from pex-renderer.
Yes, that's probably going to be formalised in glTF 3.0. Meanwhile I am also undecided.
instanceColors
is more explicit but that means than anything that is instanced should follow the convention.
from pex-renderer.
@dmnsgn any updates on that? e.g. progress of gltf discussion or maybe we should do research how babylon or three.js are naming things
from pex-renderer.
ThreeJS is actually vertexColors and instanced colors and offsets https://github.com/mrdoob/three.js/blob/master/examples/webgl_buffergeometry_instancing.html#L153
BabylonJS seem not to have instanced color support?
https://doc.babylonjs.com/how_to/how_to_use_instances
from pex-renderer.
I would propose that unless we are willing to use instance*
prefix we should close those issue and wait for GLTF to clarify.
geometry.set({
positions: [],
normals: [],
vertexColors: [],
offsets: [],
scales: [],
rotations: [],
colors: []
})
vs
geometry.set({
positions: [],
normals: [],
colors: [],
instanceOffsets: [],
instanceScales: [],
instanceRotations: [],
instanceColors: []
})
from pex-renderer.
I agree. What's your gut feeling about instance*
prefix? I am leaning toward this option as it makes it really explicit.
from pex-renderer.
One thing about instance*
prefix is that it would make it clear what's supported and what's instanced. We could then drop the requirement for { divisor: 1 }
as it would be redundant.
The question is though: do we want to support custom (instanced or not) attributes as we have custom shaders? There are generally 3 options:
- you add way to add arbitrary attribute
- you hack your data into know attributes (if you have custom shader you can write custom handling)
- we add data_0, data_1, data_2, data_3 attributes
Writing this here just for reference because I think we should strive to do minimum work and not implement any of the above yet.
from pex-renderer.
@dmnsgn @simonharrisco if we go ahead with this:
geometry.set({
positions: [],
normals: [],
colors: [],
instanceOffsets: [],
instanceScales: [],
instanceRotations: [],
instanceColors: []
})
Then is it still this:
geometry.set({
instanceOffsets: { data: [], divisor: 1 }
})
or is this now also (or only) valid:
geometry.set({
instanceOffsets: [] // divisor is assumed as this is instanced attribute and defaults to 1
})
https://github.com/pex-gl/pex-renderer/blob/master/geometry.js#L106
this is similar to allowing both:
geometry.set({
positions: { buffer: {}, offset: N, string: M }
})
geometry.set({
positions: []
})
from pex-renderer.
Good thing is all old examples will throw "unknown attribute" if we try to set e.g. offset https://github.com/pex-gl/pex-renderer/blob/master/geometry.js#L111
That will be easy to spot and fix instead of silent errors.
from pex-renderer.
geometry.set({
instanceOffsets: [] // divisor is assumed as this is instanced attribute and defaults to 1
})
Seems more user friendly and feels nice with the other properties
from pex-renderer.
To complicate things glTF uses TRANSLATION
, ROTATION
, and SCALE
in EXT_mesh_gpu_instancing and doesn't support color or material properties as of today.
from pex-renderer.
Related Issues (20)
- Add world or scene as a root ECS object HOT 6
- Consider renaming maps to textures HOT 3
- Supported material types HOT 8
- Multiple viewports and multiple systems HOT 13
- Component namespacing HOT 7
- Render Graphs HOT 1
- Provide default setup to avoid boilerplate code HOT 16
- On scaling gltf scenes HOT 4
- Proposal: rename texture.texCoordTransformMatrix to texture.transform HOT 9
- Expose debug render mode in standard renderer HOT 4
- material.id is missing and leads to cache issues HOT 4
- Improve reflection probes seams HOT 3
- Move shaders back to pex-shaders
- MSAA Antialiasing
- Layer system
- Reflection map prefiltering improvements HOT 5
- Provide default values when creating light components HOT 1
- Add support for attribute.dirty HOT 2
- Allow shadow map size customisation HOT 1
- Prevent camera helper rendering when rendering from the same entity camera component
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 pex-renderer.