Skip to content

Documentation / Example for materials #46

@dakom

Description

@dakom

Thanks for making this library! I'm looking forward to playing with it :)

One thing at a glance - I downloaded some basic sphere model from turbosquid and it comes with some material. When I load it via webl-obj-loader and console.log the mesh returned from downloadMeshes I see there's some materials.

Looking the source of material.js- I see lots of great comments on what a material is - e.g. diffuse, specular, etc.

However, I don't see any documentation of how to use this in a shader. I understand that there is no 1:1 correspondence since lighting is implementation specific, and using this library as opposed to Three.JS is all about getting down and dirty to DIY.

Still, any documentation or leads on how to get from materials to shader/js implementation is helpful. Sortof like nice how to you did with initMeshBuffers... e.g. maybe provide a helper util, but show code samples of the reasoning behind it so it's easier to build from scratch?

Right now I'm just learning WebGL and sortof at a place of basically understanding how to apply a directional light by formula (e.g. this article) - to give some context :)

Any thoughts on this are appreciated.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions