[Bf-committers] Patch for Specularity
John K. Walton
Wed, 1 Oct 2003 17:30:30 -0400 (EDT)
On Wed, 1 Oct 2003, Ton Roosendaal wrote:
> I'd prefer to have suggestions like this tested in Tuhopuu first. We've
> also decided not to add improvements in the engine until we've released
> a version with Solid restored.
> As for Blender itself, I'd prefer to stick with basic OpenGL (1.1) as
> much as possible, we indeed want to release for every system. For the
> player and engine, if (and once) the project is separated, much more
> freedom to support newer opengl releases can be added.
> Nevertheless, that will still mean testing for opengl extensions, and
> code based at all kinds exceptions for various platforms... something I
> have no experience with at all.
it's a pain, if someone does it, do it in an easy to if/then/else
out. irix is 1.1, no updates ever, only weird extensions sometimes.
> On Wednesday, Oct 1, 2003, at 19:05 Europe/Amsterdam, Martin wrote:
> > Hi - I hope the excitement over 2.28C has died down a little, and that
> > people are n the mood for a little light maintenance ...
> > Sirdude asked me to send this patch for separate specular colour to
> > him - I
> > hope this is as good.
> > Specular lighting in preview mode.
> > -----------------------------------
> > The mode Textured does not take into account the specularity of the
> > material. This is easily possible by adding to the function
> > set_draw_settings_cached in drawmesh.c
> > This sets the lighting model. It should be done once per render (or at
> > program startup). It relies on GL Extension which was introduced in
> > GL 1.2.
> > Obviously Microsoft (being Microsoft) only strictly support the oldest
> > possible version of GL (1.1), but most modern graphics cards do in
> > fact fact
> > support something a little more modern.
> > However, I need to define GL_LIGHT_MODEL_COLOR_CONTROL_EXT and
> > GL_SEPARATE_SPECULAR_COLOR_EXT somewhere, and don't really want them
> > hardcoded in this file.
> > They are included in SDL_opengl.h, but this breaks other things. I
> > hope
> > someone can sort out a more elegant way of doing it that these
> > hardcoded
> > #defines.
> > What I would like to see somewhere is a runtime initialisation to get
> > the
> > OpenGL exptension string, check that this extension is supported and
> > set a
> > flag somewhere. I don't think it should be a compile-time option, as
> > this
> > means distributing BlenderPlayer executables might not work.
> > This set the lighting model to use Separate Specular colour, otherwise
> > textures replace the calculated specular colour.
> > Place this call in RAS_openGLRasterizer.cpp, in Myinit_gl_stuff (line
> > 64)
> > glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT,
> > GL_SEPARATE_SPECULAR_COLOR_EXT);
> > Place this call in drawmesh.c, draw_settings_cached(), line 746 after
> > glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); and this sets the
> > specularity.
> > glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, ma->har);
> > In contrast with the renderer in Blender, values above about 20 cannot
> > be
> > seen. This also causes BlenderPlayer to show objects with specular
> > highlights.
> > I'm afraid I don't have a good diff output for this, as I have been
> > messing
> > about quite a lot in this file.
> > Martin
> > _______________________________________________
> > Bf-committers mailing list
> > Bffirstname.lastname@example.org
> > http://www.blender.org/mailman/listinfo/bf-committers
> Ton Roosendaal Blender Foundation email@example.com
> Bf-committers mailing list