Author Topic: about the strength of specular light  (Read 5481 times)

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
about the strength of specular light
« on: November 11, 2018, 07:00:01 pm »
Hi Egon,
i found the reflected light color is related to texture color - the light on white object is whiter than that on dark color  objects.
but in reality, some dark colored object can reflect very bright light, such as dark colored glass.
i don't aim for complex graphics so that's not very important by now.
in some engines, there is concept of " material " - not just texture, but how strong do ambient light, diffuse light, specular light affect an object.
would you consider having this in JPCT? or people need to write new shaders if necessary.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: about the strength of specular light
« Reply #1 on: November 12, 2018, 11:08:38 am »
jPCT support OpenGL ES 1.x and 2/3.x. The 2.x support mimics the 1.x pipeline by providing default shader implementations which behave just like 1.x would. And because 1.x doesn't support any advanced lighting techniques, the 2.x pipeline doesn't support them either. If one wants some other kind of lighting, one has to write a custom shader for it. I had to limit the options here somewhere, because we already have 19 different shaders plus parts that will be injected when using shadows.

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: about the strength of specular light
« Reply #2 on: November 12, 2018, 12:16:35 pm »
i see. the built-in shaders are complex enough already. thanks.

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: about the strength of specular light
« Reply #3 on: February 13, 2019, 02:21:02 pm »
i think of Config.specPow , can specPow be variable at runtime ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: about the strength of specular light
« Reply #4 on: February 13, 2019, 03:16:34 pm »
Yes, it can.

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: about the strength of specular light
« Reply #5 on: February 13, 2019, 06:08:35 pm »
so why not  have a Object3D.setSpecPow() method ?
then each object can have different specpow.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: about the strength of specular light
« Reply #6 on: February 14, 2019, 03:39:06 pm »
I don't remember that exactly. I guess, because I actually didn't consider this to be important at all. IIRC, it wasn't supported properly on a lot of older devices anyway, so I'm not even sure how well jPCT-AE handles this setting. Maybe we should take a step back: What exactly are you trying to achieve?

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: about the strength of specular light
« Reply #7 on: February 14, 2019, 05:49:58 pm »
i dont think it is very important either.
but, since full support of material is not easy to do, IF changing specPow is much easier, then it can let the users have more options without too much trouble.
changing specpow ( without other elements of material ) still has some use, such as seperating glass (sharper reflection) and plastic.
if a user have one more option, he will think of more ideas.
i agree that a developer should put efforts on essential elements and neglect unimportant elements, though.

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: about the strength of specular light
« Reply #8 on: February 14, 2019, 06:03:01 pm »
about the outcome of this setting, i did some test on powerVR 6250 gpu and could see the difference it makes.
in some cases, the specular looks quite nice. i use 50 setting and metal does look like metal on my simulated aircrafts, especially in moving images.

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: about the strength of specular light
« Reply #9 on: February 14, 2019, 06:40:17 pm »
here is a work in progress model as example of specular light


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: about the strength of specular light
« Reply #10 on: February 15, 2019, 04:08:30 pm »
It's a bit hacky, but you could try to add an http://www.jpct.net/jpct-ae/doc/com/threed/jpct/IRenderHook.html implementation to your objects and set the Config values in the beforeRendering implementation. That should actually work...I guess...

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: about the strength of specular light
« Reply #11 on: February 15, 2019, 06:37:43 pm »
i will try it, thanks

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: about the strength of specular light
« Reply #12 on: February 16, 2019, 07:22:07 pm »
yes , it works