Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Lightmap Flashlight

silvershadegames
Registered User
Quote
2022-11-07 21:17:19

Is there a way to add a flashlight that works with lightmaps? Kinda like half life


just_in_case
Moderator
Quote
2022-11-08 07:23:45

I am not so sure about that right now, as I am not into lightmaps that much. But there are workarounds with which you can use the fake flashlight on lightmaps.

simplest is to create a cone with transparent add material and allign and child it to the actual flashlight model or to your player. I have tried this earlier and it works really nice. It will be more effective if you use Black fog in your scene to darken the area and make the Cone unaffected by fog using one of my shader.

So that it will show eveything that's inside the cone and everything else will be dark.


Guest
Guest
Quote
2022-11-08 09:02:22

What Just_in_case suggest remind me of the simple 2D lighting technique. You simply need a 2d layer work as ambient lighting (usually dark), and then every light source would remove the 2d ambient light around them and replace it with their own color.

I wonder if this can be done in a 3d space.


Guest
Guest
Quote
2022-11-08 09:14:23

The drawback of this 2d lighting method is obvious, you can only see light only when you look at the light source, the light is 2d illusion and can't cast on any 3d model.So it should only work with flashlight.

But it would be a nice idea for someone want to make 2d game and need alot of lighting without worry about performance.


just_in_case
Moderator
Quote
2022-11-08 09:48:35

The method proposed by me will work for 3D objects as well, I don't have reach to my PC otherwise I would have shared the demo. Instead of using 2D overlay, I used a 3D cone with a noticeable length so that it can cover sufficient area and act more like a flashlight.

The only drawback is that if you have areas that are visible from the player perspective then sometimes the lightbeam can bee seen culling through walls.

I will share the demo when I will be in my Hometown and will have access to my PC.


Guest
Guest
Quote
2022-11-08 11:48:09

Sound good! Combine this fake lighting trick with other lighting techniques (dynamic/static/vertex), we would have unlimited light sources with different sharp with almost no performance cost. Of course the draw back is it wouldn’t look very good.


VP
Guest
Quote
2022-11-08 15:51:30

Not sure if I've off topic but the Playstation1 game (Silent Hill) used texture-swapping for all it's lighting. They rendered 2 textures for every model/scene - one scene in the dark, one scene fully lit, then - for the torch - they simply swapped the textures between dark and lit "using on proximity" to the torch. As I remember, it looked really good at the time but I may have misunderstood the post.


just_in_case
Moderator
Quote
2022-11-11 11:56:13

Just posted the dual model trick to use dynamic lighting along with Lightmaps. Thanks to new Lightmapping trick by @Anrezzz. It is now possible to use dual model for lightmaps and dynamic lighting. However this is Resource extensive trick.

https://youtu.be/0He9746-l7Q


pmax
Registered User
Quote
2022-11-11 15:58:44

@just_in_case
you can use the " Merge selected mesh into another mesh" Tool found in the "Polygon Editing" section to merge the two objects together so there is less confusion.
by using this tool you can solve the defect of displaying the face always lit.


just_in_case
Moderator
Quote
2022-11-11 17:09:20

@pmax, yeah its better to merge meshes together to have cleaner scenegraph and less amount of nodes.


just_in_case
Moderator
Quote
2022-11-11 17:47:29

Also here is the CCB file I was talking about earlier which contains the Fake Flashlight.
Turn on the fog and to make flashlight bright, Go to the behaviors attached to the flashlight and in the swap specific color action change the value from (7,7,7) to something else to control the smog and visibility of light. Try changing it to (17,17,17) and you will be able to see more clearly.

Additionally, Watch this video on Youtube to get an idea of the project. I am keeping the videos short. So might have some fewer details, but the CCB file will give you a better idea.

https://youtu.be/9PUCDpWvLvg


Download the ccb project file from here:- https://drive.google.com/file/d/...


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internati?nal" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact