question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Where are my vertex colors?

See original GitHub issue

I want to use vertex colors in my shader. After spending a few minutes reading JSON Model format 3.0 I made this model manually:

{
    "metadata":
    {
    "sourceFile": "",
    "generatedBy": "3ds max ThreeJSExporter",
    "formatVersion": 3,
    "vertices": 4,
    "normals": 0,
    "colors": 4,
    "uvs": 0,
    "triangles": 2,
    "materials": 1
    },

    "materials": [
    {
    "DbgIndex" : 0,
    "DbgName"  : "dummy",
    "colorDiffuse"  : [0.5, 0.25, 0.25],
    "vertexColors" : true
    }

    ],

    "vertices": [-100,-100,0, 100,-100,0, -100,100,0, 100,100,0],

    "normals": [],

    "colors": [6808406,16777215,5197746,5197746],

    "uvs": [[]],

    "faces": [128, 0,1,2, 0,1,2, 128, 2,1,3, 2,1,3]

}

However it doesn’t work with my shader:

"varying vec4 vColor;",
"void main() {",
"   vColor = vec4(color, 1.0);",
"   gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);",
"}"

Strangely color is always solid white. I also tried a simple box exported by ThreeJSExported with “Export vertex colors” checked. Doesn’t work either. So what shall I do?

BTW is it possible to include an alpha component in vertex colors?

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dacre-dennycommented, Mar 6, 2018

@donmccurdy thanks for your prompt response! It was an error on our part - color was being multiplied by 255 in our vertex data

1reaction
donmccurdycommented, Mar 5, 2018

@mooce for help and questions, could you post to the forum? It will also help to include details such as your code or source model (if any) for us to guess why your colors might have large values. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction — Blender Manual
Vertex Painting is a simple way of painting color onto an object, by directly manipulating the color of vertices, rather than textures, and...
Read more >
How to view vertex' colors? - Blender Stack Exchange
E.g. for 2.79, there is the command: "3D Editor > Vertex Paint mode > Header > Paint Menu > Set vertex colors". @mins...
Read more >
Painting Vertex Colors in Blender - KatsBits.com
Once Vertex Paint mode is active, to actually paint click, or click-hold and drag, the mouse cursor across the selected object to affect...
Read more >
Using vertex colors in Blender 2.8 | by Ben Olayinka - Medium
2. Hit ctrl-tab and go in to Vertex Paint mode. This will automatically create a Vertex Colors node called 'col' in the object...
Read more >
Vertex Paint color not showing up - CG Cookie
Vertex Paint color not showing up · spikeyxxx replied on May 26. Solution. Did you enable it in the Viewport Shading dropdown: Vertex...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found