Skip to content

How to add flat shaded objects #10

Answered by mario-deluna
odarcan asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @odarcan, shading is done using as you probably know shaders.

I wrote a quick description of the shading pipeline here: https://phpgl.net/getting-started/drawing_a_triangle.html#the-rendering-pipeline

My getting started guide is unfortunately not yet complete so for further details you have to consult different sources.

Now for your question specifically. If you just want to be able to shade things with plain colors in a "low-poly" like style
I would go with a simple "flat shading" model or "phong shading".

For a simple example consider this code:

note: I make use of the 99_example_helpers.php file here, also this example should provide more clarity from an OOP background but does not…

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
11 replies
@odarcan
Comment options

@mario-deluna
Comment options

@odarcan
Comment options

@odarcan
Comment options

@odarcan
Comment options

Answer selected by mario-deluna
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants