Open Theverat opened 7 years ago
Navigating with WASD and moving the light with IJKL is overly complicated in my opinion. I think it would be enough if the user can rotate the cube with the mouse, camera and light don't need to be movable.
In which case (static light, static camera, ability to rotate cube) user will not have any opportunities to see how looks not illuminated sides of the cube. I think, rotating camera using mouse around static cube with static light, would be the better way. Though it's technically harder.
All the features about influences of particular maps are on point. But before taking care of it i'll enable influence of specular map, that's won't take long. So after i can make these features for all the generated maps.
Smooth shading on the mesh possible?
i've just read about this technique, and will be interesting to try it. But likely after other items on this list.
Hello =) There's a lot things about light which are very relative to some parameters. For example: Applying specular map need at least two parameters:
float number that controls the brightness of reflection.
float number that controls amount of pixels for which specular influence will be calculated.
I don't want to complicate project too much, but hardcoding this part doesn't seems good idea. So maybe best option is to add "light options" button to viewer and give possibility to user to change this constants.
Hm, I thought the brightness of reflection is controlled only by the pixels in the specular map (0 -> no reflection, 1 -> full reflection). And isn't the amount of influenced pixels simply all of them? Or maybe all minus those where the specularity map is 0? Would this cause a performance hit?
Do you have a link for the kind of shader you are referring to so I can better understand where these parameters come from?
Didn't see that you already commited it.
Another note: do you plan to take the fresnel effect into account for the specular shading? It's not something we have to do right away, but since most renderers today are using physically based shading it would be useful if the preview takes that into account, too.
Well, I commited hardcoded version.
This "brightness" It's like depth value for displacement map 0.0 1.0 10.0
About "amount of influenced pixels" i just couldn't express myself correctly
i meant this:
float cosAngle = max(0.0, dot(surfaceToCamera, reflectionVector));
float specularCoefficient = pow(cosAngle, light.MatShines);
so cosAngle lies between 0 and 1 and exponentiation will reduce radius of affected pixels.
this constant 10.0
and same constant = 30.0
About fresnel Yes, i will try to do this.
so cosAngle lies between 0 and 1 and exponentiation will reduce radius of affected pixels.
So it's basically the roughness?
i guess it's not, or it's and i just couldn't understand you. But just to be sure i will try again.
in this screenshots color of every pixel was made just from specular influence
10.0
30.0
It's called roughness?
Looks a bit like it, but I'm not sure. We can add a slider for it and see if it's useful. Here's an example how roughness usually works in renderengines: http://dragengine.rptd.ch/wiki/lib/exe/fetch.php/gamedev:chart_roughness.png
Thank you for example. Yea, it looks close. And what about brightness?
For now we can also add a slider for it. But in the end I think we can choose one value that works good and hide the slider. By the way, I don't think all of this stuff has to be perfect, after all people are using this tool with all kinds of renderengines, so the preview will never be accurate for all of them.
I pushed a commit to display an error message when the shaders failed to compile. I hope this doesn't cause merge conflicts at your end.
That caused, but seems like it's fine for now.
without normal mapping
with normal mapping
i had no idea, normal mapping was this important!
The difference is very strong here because of the flat shading.
Your last images look very different in lighting, notice how there are very bright faces in the top image, but only dull grey in the bottom image. I think there's a bug in the normalmap apply code somewhere, maybe some vector transform is wrong. I added example images in the first post that also show the problem.
Another thing I noticed: If I understand it right we are currently using the normalmap only for diffuse lighting, right? Specular lighting is taking the geometry normal, without the normalmap: https://github.com/Theverat/NormalmapGenerator/blob/3d_preview/shader.frag#L66 Maybe we can write a function that returns the normal and use it for both diffuse and specular lighting.
This tutorial could be helpful: http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-13-normal-mapping/
Another thing I noticed: If I understand it right we are currently using the normalmap only for diffuse lighting, right?
That's correct. I'll try to fix it in few hours.
I saw your latest commits, great stuff. Meanwhile I tried to implement smooth shading, more precisely Phong shading, but I'm failing hard. Most of the GLSL specifics are gibberish to me, it seems there are thousands of ways to specify input and output variables and other weird stuff. Do you know a beginner tutorial that explains this shader stuff by chance?
Thanks! Yea, there a lot of information. And honestly i don't remember if i have seen any beginner tutorials not about "drawing colored triangle".
After searching a bit longer, I found a tutorial that explains the syntax pretty good: http://www.lighthouse3d.com/tutorials/glsl-tutorial/glsl-core-tutorial-index/
Hello there! How is it going with smooth shading? maybe can i help?
Sorry, the last days were busy so I could not work on this project. If you like you can start yourself.
I probably will make camera control next. Was just asking if i could help you with opengl and shaders stuff :)
Thanks, I'll ask if something comes up. But until wednesday next week I can't do much because I'll be travelling.
This is a collection of ideas and possible features for the 3d_preview branch.
Usability:
Show a message when OpenGL 4.x is not supported by the systemDone: 55e80fe02ca72c5821b66f543730b366f2be8f95Navigating with WASD and moving the light with IJKL is overly complicated in my opinion. I think it would be enough if the user can rotate the cube with the mouse, camera and light don't need to be movable.Done.Rename "partition frequency" to "mesh resolution"Done.Features:
It should be possible to disable the influence of each map (for example to study only the normalmap influence without any displacement)Done.The preview should start when the first map is generated, it should not require all three mapsDone.I think the background should be black or grey, because currently it doesn't match the lighting in the scene (there's no purple environment light as far as I can tell)Done.Bugs:
When a new image is loaded, the old maps are still used in the preview (they are only replaced when new maps are generated)Done.There are huge differences in lighting between enabled and disabled normalmap, maybe there's a bug in some vector transform?Done.