Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / light help please

Author
Message
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 4th Aug 2018 07:10
I have created a room that is textured and tried all three methods of lighting point directional and spot light but i can get the effect of candle or torchlight on a wall no matter what i do. Im not sure what i need to accomplish this.
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 4th Aug 2018 17:13
So you can do 2 things here

One is to move your lights back and forth

for lights=1 to 7
inc movelight
if movelight>200 then move light lights,1
if movelight<200 then move light lights,-1
if movelight>400 then movelight=0
next lights


This will move your lights, but it will not look like you want I'm sure.


What I would do is if I was you is make a animated sprite with the effect of a candle light movement, put the image to a plain then play the sprite on the plain.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 5th Aug 2018 04:08
Yeah im not sure either of those methods would work. the light my torch casts lands on several walls there is low ambient light in the scene. the baked light illuminates the scene brightest at its center behind the torch but i need to give the appearance of a torch flicker dont care if the actual flame moves but the light needs to change intensity just a bit. im actually having trouble making a light map for a complex object since lit surfaces are spread across multiple uvs. If dark basic cant do a simple lighting of a room i think this is the final nail in the coffin for me.
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 5th Aug 2018 04:29
Then you will need to use a animated sprite for the effect, thats what your going to want to do any how.

If you need help let me know.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 5th Aug 2018 08:38
sprites are out of the question this is a full 3d dungeon crawler. I found a solution though. If i take the baked uv texture delete everything except a small area that is lit then burn it in photoshop i can make 10-15 images for the 8 torches that are visible. then i texture the second object with images in series and ghost the first object on. its not a perfect way of doing it but the results are acceptable.
A child's dream never dies.





chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2018 11:05
Hi there

Quote: " If i take the baked uv texture delete everything except a small area that is lit then burn it in photoshop i can make 10-15 images for the 8 torches that are visible. "


That could be a solution endeed . Another method to get that effect could be playing with the light range + rnd(xx) or light colour.

Here's a little example.


I'm not a grumpy grandpa
Chris Ritchie
18
Years of Service
User Offline
Joined: 7th Jan 2006
Location: Norn Iron
Posted: 5th Aug 2018 13:33
Nice effect chafari .

Lead programmer ULIDIA
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2018 16:16
@Chris Ritchie
I'm glad you like it .
I'm not a grumpy grandpa
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 5th Aug 2018 16:44
tried the code chafari indeed that is pretty cool. I think i can use this 100% with no problem and eliminate the headache using lots of images thank you
A child's dream never dies.





chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2018 16:57
@smerf
Thanks for your comments...enjoy it!
I'm not a grumpy grandpa
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2018 16:57 Edited at: 5th Aug 2018 16:58
Oops double post...sorry
I'm not a grumpy grandpa
gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 5th Aug 2018 20:55
You can use sprites on plains in a 3d world and it looks almost real, and you can play the animated sprite plains in a 3d environment, its simple to do my good friend.

But I'm glad chafari helped you with this, I hope you got it working.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2018 21:12
@hamehazer
Your method of sprites is much more realistic . I have used sprites and animated gif to get nice looking objects. Even for a flickering wall we could use animated gif...sprites or a serie of images . The method I showed here is the poor and fastes way we can get flickering lights...and it use somehow the same principles you suggested above moving the lights back and forth...in this case I used the power range instead...but your method is good aswell . We old programmer are all the time trying to reinvent the wheel
I'm not a grumpy grandpa
gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 5th Aug 2018 21:17
@chafari

lol, thats the truth, I wish there was more people on these forums to help and to talk with, its a old dead forum but at least we are here to talk about what we love.

Something like this here is a good example and so many others could learn programing if they learned about Dark basic pro.

I tried your example, but had to change a couple things to work as I dont use others plug ins, but it works well.

The flickering is a little to much for my eyes lol.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2018 21:43 Edited at: 5th Aug 2018 21:45
Yeah...I remember that days when you nearly couldnt have lunch because we where all the time in front of our PCs learning or trying to help other friends. We are lot of Dbpro members but perhaps we got lazy somehow ...but life is so ...I will try to help while I can...and will ask other friends when I get stuked lol

About plug-in....l dont even know how many I have instaled.

Cheers hamehazer
I'm not a grumpy grandpa
gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 5th Aug 2018 23:01
I was playing around with chafari code and this is what I came up with, it looks cool in my game, but will not use it as it hurts the eyes lol.

chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2018 23:31 Edited at: 5th Aug 2018 23:41
Yes...imagine not only 7 lights but 100 at the same time . We can put more than 100 lights a the same time but switch only the nearest to the player .

Example . note it needs Matrixutils1 dll




Same example without Matrixutils


I'm not a grumpy grandpa
gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 5th Aug 2018 23:56
WOW, that is cool, I had to correct it with fixing the

INK RGB(255,255,0),RGB(0,0,255)

But still, wow, it was pretty neat.

I also saw something interesting myself.

When I just change the light color every loop and not the light range the effect is much smoother and does not flicker like a disco dance,it looks more real.

chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Aug 2018 00:05
Imagine this amount of lights ...be carefull not to get blind .

I'm not a grumpy grandpa
gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 6th Aug 2018 00:14
That is neat, I will use this for some effects in game, thanks.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Aug 2018 00:25
Wow !! you are right gamehazer !!! with your change:

Quote: "for lights= 1 to 7

col=rnd(60)
color light lights,rgb(100+col,100+col,0)

next lights"

it is much smoother ...and you don't run the risk of qetting blind

I'm not a grumpy grandpa
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Aug 2018 01:09 Edited at: 6th Aug 2018 01:27
thinking maybe the root of my issues are not so much the light but the way the model is set up. it seems to not respond to any light at all unless there is a bright area already on the texture darker areas do nothing where light is needed the most. I am using a textured model btw.
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 6th Aug 2018 01:12


Setting if the object is effected by 3d lights must be activated by the above code.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Aug 2018 01:29 Edited at: 6th Aug 2018 01:31
yes its set to 1
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 6th Aug 2018 01:43
Setting the cull to one will ensure the object is culled so that away-facing polygons are not drawn, that could be the problem with the light also, but I cant run your program to be to sure as I dont have it to test.

Also you dont have to time your loop rates as the light will change color per loop any how.

It also could be this


position light 2,camera position x(0),2,camera position z(0)+1

You want to keep your light in a constant place when checking your problems, as it could be the main problem.

Thats all I can think of with out the program its self.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Aug 2018 02:05
no i have my light attached to my camera atm so i can move it around the map for testing. the cull is set to 0 which ensures everything is drawn.
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 6th Aug 2018 02:16 Edited at: 6th Aug 2018 02:17
Have you set your ambient light level down to 0 so the only light there is , is the light your trying to calibrate? this might help to see if it is not reflecting off your objects.

Also try to set normalization off to see what happens
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Aug 2018 02:22
yeah its only reflecting off certain surfaces. image is attached. the light is in the same spot as the cube and its darker then heck. if i move the light to a lighter area it works fine. hmm think i just realized something my baked textures have dark areas baked so i may need to do an ambient bake
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 6th Aug 2018 02:31
Or just dont use baked textures.

Also you could use the load modes to see how the model loads in different modes as in

load object "",1,load mode= 1 to 5

Load Mode:
0-DBV1 legacy behaviour
1-DBPro : DBPRO default behaviour
2-Leave states alone to keep material/diffuse effects
3-Leave states alone to keep material/texture effects
4-Ensure object blends texture and diffuse at stage zero
5-Leave states alone to keep multi-material effects

Reduce Texture Mode:
0-No Reduction
N-Divide By N
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Aug 2018 02:46
Intresting had no idea about the flag on the load. I'm using the new compiler but I'm still using my help files from my 12 year old darkbasic maybe it's an upgrade I wasn't aware of lol
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 6th Aug 2018 04:02
Smerf, are you from new Mexico? Because I live in New Mexico.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Aug 2018 05:35 Edited at: 6th Aug 2018 05:43
indeed i am got the lights working with an ambient texture map no baked shadows but the light doesnt seem to choose where it wants to illuminate and does so strangely image attached. you can see the line on the left there should be no line. theres not even a line of geometry on the model there
A child's dream never dies.





Attachments

Login to view attachments
gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 6th Aug 2018 06:08
Do you have any light maps included? If not this might be the problem.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Aug 2018 06:48
turns out my model has some poor geometry figured since it looks beautiful in blender it would elsewhere not the case apparently
A child's dream never dies.





chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Aug 2018 09:53
Quote: "thinking maybe the root of my issues are not so much the light but the way the model is set up"


If you are using a textured model (lightmapped) , I think you had better using a shader like Evolved flashlight .
Here's a free example from his page :
I'm not a grumpy grandpa

Attachments

Login to view attachments
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 6th Aug 2018 15:35
It looks like darkbasic does light shading by Face. My entire floor was one big face so darkbasic would divide the face and only light a half at a time poorly. The. X conversion created a lot of bad lines as well that messed up lighting. Fixed the model added extra subdivisions ended up with some very smooth Lighting on the surface of the model turns out blender does a crap job at. X exporting as well. How do you export as 3DS then convert to X from exterior program. I am curious how a Sprite lighting method works because my entire level is moving constantly walls are getting bigger as they come into view moving from side to side as the player travels seems like it would be a very difficult thing to make a Sprite for. I'm also very thankful for all the help. It's nice to see The Forum still quite active
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 6th Aug 2018 21:42
This is why I use only fps creator as a level builder, It does every thing I need and I can still edit the level if needed.


I do use blender a lot, but just for regular models.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 7th Aug 2018 07:22 Edited at: 7th Aug 2018 07:30
ok i have a couple questions question1:, how do i keep light from going through walls.i could use a spot light and an angle with a range but i feel there should be another option. 2nd question my first object (my walls) have shadow shading set to 1 on them but they do not cast shadows onto my floor how do i fix this. 3rd question: is there a way to smooth out lighting on a surface?

i checked out evolved's shader how the heck do i use it. never used a shader before.His stuff is seriously amazing if only he had dark basic training classes online id sighn up
A child's dream never dies.





chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 7th Aug 2018 10:39 Edited at: 7th Aug 2018 10:47
@smerf.
Quote: "how do i keep light from going through walls"

Shadow shading works, but we have to set first hour level ... something like this:

I'm not a grumpy grandpa
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 7th Aug 2018 10:44
Quote: "2nd question my first object (my walls) have shadow shading set to 1 on them but they do not cast shadows onto my floor how do i fix this"


The floor must be another object like in example avobe.

Quote: "3rd question: is there a way to smooth out lighting on a surface? "


Yes there's a way to achive that ...subdividing the objects, but we would no longer work in low poly.
I'm not a grumpy grandpa
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 7th Aug 2018 15:30
Thanks for the help guys. I mostly write programs and 2d games this is my first big 3 d project. Nice to have some help. Have another guestion actually. Would it be acceptable to white some fake shading code that Copy my texture map then does a estimated 2 d calculation based off wall mask and bake some fake shadow and ground light like a flashlight then update the object texture or is that too intensive for the game loop. Thinking I could use pretty small images to accomplish this shouldt need much detail but might save me. About 3 k verts
A child's dream never dies.





smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 7th Aug 2018 15:37 Edited at: 7th Aug 2018 15:39
Hmm think I just had an idea. What if I create a light map and apply it to a ghosted model then I make a black image with a gradient hole in an alpha and I scroll it over the light map based on my player position then when the player walks the ground below the movie smoothly illuminated based on the light map. Or better yet just use a blacklight map and have a white circle with a gradient that moves and updates the ghosted objects texture
A child's dream never dies.





chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 7th Aug 2018 22:10
Scrolling the object texture is going to give you a weird effect...but you can try.
What is exactly the effect you want to get?
I'm not a grumpy grandpa
gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 7th Aug 2018 23:30
to do this you going to have to do this to every level and ever room and every wall, to much work truly.

I do belive there are some light mapping programs on this forum, some for free, I could be wrong.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 8th Aug 2018 15:59
I have the lighting perfect and beautiful but I can't seem to get shadow shading to work properly. I have shadows shading set to my walls obj light set to zero floor light set to 1 have a moving light under camera.

Set shadow shading on 1,-1,100,1 took some advice and put the native f2f shader files in the folder as well. All it really seems to do is mess up my ground textures badly. And at the far edge of my map I have a tiny shadow that barley moves when the camera does but I can't even find the wall making the shadow. I am not using a mesh btw is it necessary?
A child's dream never dies.





chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 8th Aug 2018 16:55
Quote: "I am not using a mesh btw is it necessary?"


It is hard to say without seen your object...could you post your level example to test?
I'm not a grumpy grandpa
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 9th Aug 2018 04:47
here is code and attached models and images in zip
A child's dream never dies.





Attachments

Login to view attachments
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 9th Aug 2018 10:41
@smerf ...I'm on it....I'll post it when ready .
I'm not a grumpy grandpa
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 9th Aug 2018 17:39 Edited at: 9th Aug 2018 17:46
Lol thanks. I have a very deep love for dark basic but if I cant have shadows and lighting it's time to move to unreal. I might anyway. I drug my model into unreal last night and boom lights n shadows easy real time material editing didn't have to add and extra 10 k verts to my model make the light look ok either.
A child's dream never dies.





gamehazer
5
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 9th Aug 2018 20:46
@ smurf, I advice against that,


As unreal looks and feels good, it is full of bugs and you have to script a lot, its just not worth it.

PLUS, And this is the biggest reason, its not a coding program, its a game engine already uncapable to do so much you can code your self.


Like in dark basic I can code just about anything I want to happen on the screen, anything I can imagine, but in unreal you can only do what they have implemented for there engine.

Login to post a reply

Server time is: 2024-04-24 13:06:01
Your offset time is: 2024-04-24 13:06:01