Author Topic: Fake volumetric lights  (Read 8908 times)

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Fake volumetric lights
« on: October 11, 2012, 01:20:46 am »
Is this doable in JPCT-AE ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Fake volumetric lights
« Reply #1 on: October 11, 2012, 07:13:48 am »
Depends on what exactly you mean???

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Fake volumetric lights
« Reply #2 on: October 11, 2012, 07:23:20 am »
You can do it by transpatent plane  ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Fake volumetric lights
« Reply #3 on: October 11, 2012, 07:26:02 am »
So...something like this:



 ???

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Re: Fake volumetric lights
« Reply #4 on: October 11, 2012, 10:53:33 am »
Something more like http://udn.epicgames.com/Three/rsrc/Three/VolumetricLightbeamTutorial/lightbeams.jpg

The lights on the car look more flat, I would like to use a conse instead of a plane, as explained here: http://udn.epicgames.com/Three/VolumetricLightbeamTutorial.html

But to be honest, I don't even know if that is what I'm really looking for.... I want to achieve something like this:



« Last Edit: October 11, 2012, 10:58:46 am by robert »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Fake volumetric lights
« Reply #5 on: October 11, 2012, 11:16:49 am »
Something like a...missing image...?

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Fake volumetric lights
« Reply #6 on: October 11, 2012, 11:52:44 am »
You could cheat and change the texture of the inside of that pumpkin, make the inside colors pure white so it appears lit up.

Additionally, you could separate the inside and outside of the 3D pumpkin object and setAdditionalLighting(200,200,200) to the inner Object3D. Or perhaps pop a small hardware Light in the center.

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Re: Fake volumetric lights
« Reply #7 on: October 11, 2012, 12:22:47 pm »
Something like a...missing image...?

I don't know what happened, the image was shown the first time I put it. Anyway, what I want to achieve is the lighting of the inside of a halloween pumpkin.

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Re: Fake volumetric lights
« Reply #8 on: October 11, 2012, 12:24:53 pm »
You could cheat and change the texture of the inside of that pumpkin, make the inside colors pure white so it appears lit up.

Additionally, you could separate the inside and outside of the 3D pumpkin object and setAdditionalLighting(200,200,200) to the inner Object3D. Or perhaps pop a small hardware Light in the center.

I will try your first method, but I'm afraid I'll need two pumpkins because as far as I know, a texture can't be mapped to both sides of a mesh. The downside of this method is that I won't get a "glow" effect.

About the second method... what do you mean a hardware Light ? a light done with fragment shaders ?
« Last Edit: October 11, 2012, 12:30:09 pm by robert »

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Fake volumetric lights
« Reply #9 on: October 11, 2012, 02:07:25 pm »
You wont need two pumpkins, 3D modelling programs like blender allow you to select all the vertices and extend them inwards, effectively creating a complete 3D object with both inner and outer walls. Once that is done, apply a white part of the texture to the inner faces.

OpenGL hardware typically have 8 hardware lights you can use. Refer to the "Light" class in jPCT, set it's position to the center of the pumpkin to light it up. You could use shaders but it can be a steep learning curve if you are just starting to use OpenGL.

...Edit: Well actually yes you could use two pumpkins and invert the faces of the inner one and apply a bright texture to it, but you may run into visible artifacts or 'jaggies' at the edges of the objects if they are too close in 3D space.
« Last Edit: October 11, 2012, 02:16:19 pm by K24A3 »

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Re: Fake volumetric lights
« Reply #10 on: October 11, 2012, 02:12:04 pm »
You wont need two pumpkins, 3D modelling programs like blender allow you to select all the vertices and extend them inwards, effectively creating a complete 3D object with both inner and outer walls. Once that is done, apply a white part of the texture to the inner faces.

OpenGL hardware typically have 8 hardware lights you can use. Refer to the "Light" class in jPCT, set it's position to the center of the pumpkin to light it up.

I have been using Blender for years occassionally, but I'm far from being an expert :) How do you apply a texture to both sides of a mesh using the UV editor ? When you unwrap a mesh it is unwrapped on one side only  ???

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Fake volumetric lights
« Reply #11 on: October 11, 2012, 02:24:53 pm »
I must agree it was a battle learning even the basics of Blender.

jPCT doesn't support dual sided polygon textures (which is good in a way, keeps things simple) so you will need to solidify the object as mentioned. Rather than copy the outer texture co-ordinates to the inner faces, you would want to simply apply white to the inside to mimic the light volume. You do this by selecting all the inner faces and either apply a white material from the materials menu on the right, or hop into texture mode, load up your texture, select a portion of the texture that contains white, then wrap that portion to the polygons you have selected. It's not easy to do so I wont go into it in detail, but there are plenty of video guides on youtube that will get you started.

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Re: Fake volumetric lights
« Reply #12 on: October 11, 2012, 02:48:30 pm »
I must agree it was a battle learning even the basics of Blender.

jPCT doesn't support dual sided polygon textures (which is good in a way, keeps things simple) so you will need to solidify the object as mentioned. Rather than copy the outer texture co-ordinates to the inner faces, you would want to simply apply white to the inside to mimic the light volume. You do this by selecting all the inner faces and either apply a white material from the materials menu on the right, or hop into texture mode, load up your texture, select a portion of the texture that contains white, then wrap that portion to the polygons you have selected. It's not easy to do so I wont go into it in detail, but there are plenty of video guides on youtube that will get you started.

Thank you.

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Fake volumetric lights
« Reply #13 on: October 11, 2012, 03:20:20 pm »
No probs. If you want a glow effect as well you could experiment with a simple transparent plane centered near the front-center of the pumpkin with a 32bit (RGBA) texture that fades out from the middle. Beyond that you would need to use shaders, i.e. if you wanted a fancy glow extruding out of the pumpkin.

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Re: Fake volumetric lights
« Reply #14 on: October 14, 2012, 01:25:03 pm »
No probs. If you want a glow effect as well you could experiment with a simple transparent plane centered near the front-center of the pumpkin with a 32bit (RGBA) texture that fades out from the middle. Beyond that you would need to use shaders, i.e. if you wanted a fancy glow extruding out of the pumpkin.

Hey K24A3, better than using a plane, I think I'm going to use 2 textures, the base one and one for the glow. Then I'll turn up and down the opacity of the glow texture. I got the idea from here: http://www.purebasic.fr/english/viewtopic.php?f=16&t=46130

What do you think ?