jerome2kph
Community Member

Posts: 58
|
 |
« on: February 06, 2010, 12:59:18 PM » |
|
I want to put a global/sun light to my project and able to cast shadows. how will I do it in C#?
|
|
|
|
|
Logged
|
|
|
|
Toaster
Community Member

Posts: 293
Crap I burnt the toast! :P
|
 |
« Reply #1 on: February 06, 2010, 03:17:03 PM » |
|
With shadow gen once its released or you can use stencil shadows. Do a quick search on the forums on how to use stencil shadows, its not hard.
-Toaster
|
|
|
|
|
Logged
|
|
|
|
Raul
Customers
Community Member
    
Posts: 542
I like games.
|
 |
« Reply #2 on: February 06, 2010, 03:22:47 PM » |
|
BTW TOASTER
when will be the next version of shadowgen released?
|
|
|
|
|
Logged
|
|
|
|
|
Gamecode
|
 |
« Reply #3 on: February 06, 2010, 03:58:50 PM » |
|
BTW TOASTER
when will be the next version of shadowgen released?
good question
|
|
|
|
|
Logged
|
aiR Captains - RC aircraft project TV65
|
|
|
Toaster
Community Member

Posts: 293
Crap I burnt the toast! :P
|
 |
« Reply #4 on: February 06, 2010, 04:14:09 PM » |
|
Soon very soon I hope. :p
-Toaster
|
|
|
|
|
Logged
|
|
|
|
Raul
Customers
Community Member
    
Posts: 542
I like games.
|
 |
« Reply #5 on: February 06, 2010, 05:53:22 PM » |
|
ontopic: directional lighting is what you need for "sun light" offtopic: Toaster, we all waiting for that 
|
|
|
|
|
Logged
|
|
|
|
jerome2kph
Community Member

Posts: 58
|
 |
« Reply #6 on: February 08, 2010, 10:57:40 AM » |
|
when I export models on 3ds max, it has an option to include lightmap. can I use this instead of coding the lights? and does light map include shadows. do I still need to call the light engine to enable lightmapping?
|
|
|
|
|
Logged
|
|
|
|
jerome2kph
Community Member

Posts: 58
|
 |
« Reply #7 on: February 08, 2010, 12:34:32 PM » |
|
also, i got this error when putting a directional light. AccessViolationException

click the image for actual size
|
|
|
|
« Last Edit: February 08, 2010, 01:00:07 PM by jerome2kph »
|
Logged
|
|
|
|
|
Zaknafein
|
 |
« Reply #8 on: February 08, 2010, 01:19:57 PM » |
|
Well you need to do that after Init3DWindowed(). Can't do most things before the engine is inited.
|
|
|
|
|
Logged
|
|
|
|
jerome2kph
Community Member

Posts: 58
|
 |
« Reply #9 on: February 08, 2010, 01:44:19 PM » |
|
thanks zaknafein... but the light doesn't seem to have effect on the models... I've tried both point and directional. can you give me a full example/demo scene using lights? and about my question about lightmaps, can you explain it to me. I'm sorry for being a newbie. hehe.
|
|
|
|
|
Logged
|
|
|
|
Raul
Customers
Community Member
    
Posts: 542
I like games.
|
 |
« Reply #10 on: February 08, 2010, 03:23:49 PM » |
|
Do you specify to your models what kind of light do you use? TVMesh.SetLightingMode ( .... )
|
|
|
|
|
Logged
|
|
|
|
jerome2kph
Community Member

Posts: 58
|
 |
« Reply #11 on: February 09, 2010, 12:00:53 AM » |
|
thanks. I'll try it. anyway, about my question about lightmapping. will someone explain it to me.
|
|
|
|
|
Logged
|
|
|
|
|
asia
|
 |
« Reply #12 on: February 09, 2010, 03:12:51 AM » |
|
Lightmaps are a second layer of textures added to your mesh. They will give you the shadows. Of course the shadow will be on the mesh itself. So you must have a lightmap for the floor or for the terrain. Lightmaps are good when the meshes are static (not moving). There are several software for buiding lightmaps. I mainly use Giles which is free. http://www.truevision3d.com/forums/companion_tools/lightmaps_and_giless_a_small_utility-t19575.0.htmlGreeting Fabio
|
|
|
|
|
Logged
|
Fabio Musmeci ENEA CR Casaccia Via Anguillarese 301 00060 Rome Italy musmeci@enea.it+39 3333934898 Learning to live better on a smaller footprint..
|
|
|
jerome2kph
Community Member

Posts: 58
|
 |
« Reply #13 on: February 09, 2010, 05:36:39 AM » |
|
how do I set the intensity/brightness of a point light?
|
|
|
|
|
Logged
|
|
|
|
jerome2kph
Community Member

Posts: 58
|
 |
« Reply #14 on: February 09, 2010, 06:13:04 AM » |
|
here are some of my lighting settings... the scene is so dark. can anyone suggest some proper parameter settings... IDLight = Lights.CreateDirectionalLight(new TV_3DVECTOR(0, 300, 0), 1, 1, 1, "dir light", 1);
IDMat = Mats.CreateLightMaterial(1, 1, 1, 1, 0.15f, 1, "basic material");
iit.SetMaterial(IDMat, -1); iit.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_NORMAL, 0, 1);
|
|
|
|
|
Logged
|
|
|
|
|
asia
|
 |
« Reply #15 on: February 09, 2010, 07:01:49 AM » |
|
your light is pointing up... The direction should be with a negative Y. Also, because it is a direction it should be normalized (or "nearly" normalized). I suggest the following direction: -1,-1,1 Also the material stuff needs to be changed. I think you should use creatematerial and all after al the setting like setabmient, setdiffuse etc. Try! Also for the light you can set a lot of stuff! Bye Fabio
|
|
|
|
« Last Edit: February 09, 2010, 07:06:27 AM by asia »
|
Logged
|
Fabio Musmeci ENEA CR Casaccia Via Anguillarese 301 00060 Rome Italy musmeci@enea.it+39 3333934898 Learning to live better on a smaller footprint..
|
|
|
|
asia
|
 |
« Reply #16 on: February 09, 2010, 07:14:09 AM » |
|
I was thinking you may download the TV6.3. That is full of examples and many things are similar to TV6.5 Greetings Fabio
|
|
|
|
|
Logged
|
Fabio Musmeci ENEA CR Casaccia Via Anguillarese 301 00060 Rome Italy musmeci@enea.it+39 3333934898 Learning to live better on a smaller footprint..
|
|
|
jerome2kph
Community Member

Posts: 58
|
 |
« Reply #17 on: February 09, 2010, 09:22:54 AM » |
|
isn't the first three parameters of TV_3DVECTOR the position of the light? is it the position or the direction. I also noticed that when I set the 0.15f value to 1 in the CreateLightMaterial, the scene goes bright but it makes the light pointless because it's just like setting the lighting mode to none.
|
|
|
|
|
Logged
|
|
|
|
|
|
jerome2kph
Community Member

Posts: 58
|
 |
« Reply #19 on: February 09, 2010, 09:49:45 AM » |
|
tnx 
|
|
|
|
|
Logged
|
|
|
|
|