Giter Site home page Giter Site logo

Comments (2)

m-7761 avatar m-7761 commented on July 20, 2024

Here's the numbers with 100/100 default material. I recommend disabling GL_LIGHT_MODEL_AMBIENT to make things simpler, even though it might cause things to appear black in debugging. I had to use glLightModelfv with a pointer to zero it.

GL_LIGHT_0 (modelviewport.cc)

	GLfloat ambient[]  = { 0.2f, 0.2f, 0.2f, 1.0f }; //(0.8+0.2)*0.2
	GLfloat diffuse[]  = { 0.72f, 0.72f, 0.72f, 1.0f }; //0.9*0.8

GL_LIGHT_1 (modelviewport.cc)

	GLfloat ambient[]  = { 0.2f, 0.12f, 0.12f, 1.0f }; //(0.4+0.2)*0.2
	GLfloat diffuse[]  = { 0.72f, 0.4f, 0.4f, 1.0f }; //0.5*0.8 

The added 0.2 term is GL_LIGHT_MODEL_AMBIENT. Edited: Note it's important the lights don't sum to 100% so wire frames remain visible over polygons.

from mm3d.

m-7761 avatar m-7761 commented on July 20, 2024

BTW this does look much better in texture mode, and the red face selection is visible (as long as the texture isn't red) for a change. I have to get used to seeing models darker with lighting, but it looks correct.

EDITED: In texwidget.cc the material preview uses 0.8 for ambient because it's compensating for GL_LIGHT_MODEL_AMBIENT which defaults to 0.2. I also felt that texture mode was a bit too dark because of the need for the solid mode to not overpower the wireframes (which is still a problem in texture mode for untextured materials, or very bright textures) so I had the modelviewport.cc code to add 0.1 ambient to GL_LIGHT_MODEL_AMBIENT. Not sure if that's best since it still leaves diffuse down around 90% but it looks alright for materials with high to 100% ambient. I'm thinking about adding a something to control the lights and background color. The bright background is too strong working with additive blending modes.

from mm3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.