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.

DLL Talk / Using Evolved's flashlight shader on a [DarkLights] lightmapped model

Author
Message
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 15th Apr 2010 18:11
Does anyone know how I can change EVOLVED's flashlight shader to work with a model lightmapped with DarkLights?

I have the shader here:


...and currently the shader is applied to the lightmapped object as follows:

(adapted from the example)

The problem seems to be that the shader is using the wrong texture channel (I think)? but I have no idea how to proceed...

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 15th Apr 2010 20:41
In your texture object command, try changing the stage number to 2.

It would be a little easier to guess at the issue with a screenshot of the output.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 15th Apr 2010 22:21
Oops, yes I did have 2 in there but I've been experimenting with the results.

I'll stick a screenshot up ASAP but basically I was getting a white model (no textures or lightmaps)...

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th Apr 2010 02:51
A few little things come to mind,

- On the LOAD EFFECT line, change the textures flag to a 1. I've had issues with that being opposite of what the docs say.

- Hide light 0. It may be close enough and bright enough to wash out your textures.

I'm guessing it's the first one, but the second might have something to do with it too. I had the same problem a while back, but all my models were black. I changed the texture flag on the load effect command and they showed up.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 16th Apr 2010 11:25
Quote: "On the LOAD EFFECT line, change the textures flag to a 1"

No change I'm afraid!

Quote: "Hide light 0"

I'm already doing that too.

Here is an image so you can see what's happening, you can see the lightmapped model and the same model with the flashlight activated has a strange effect:


Here is the effect loading code:


Here is the code in the loop:


KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th Apr 2010 18:26
So I'm assuming the top one has the Flashlight shader activated?

I'm not going to pretend I know how the shader works, but I am becoming a little more familiar with them.

You might do some debug prints of your shader variables to be sure you're sending it what you intend.

I also didn't notice in your code where you set the technique. There are several in the shader, you might try SET EFFECT TECHNIQUE 1, "Light0" and see what happens if you haven't already done that.

Also, the shader is expecting 3 textures on the object. A base texture, probably the color. A lightmap, and your CubeMap texture, which I'm assuming is the flashlight.

So you'll want to texture your object like,

texture object 1001, 0, ColorTexture
texture object 1001, 1, Lightmap
texture object 1001, 2, FlashLight

The stage numbers have to match the order that the textures are listed in the shader file, starting at stage 0.

I'll try and make some time today to play with the flashlight shader and see if I can duplicate your problem.

If you could send me your model and textures that would make it go a little faster. You can zip them and post here, or email them to me. Up to you.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 16th Apr 2010 18:48 Edited at: 16th Apr 2010 19:03
Quote: "You might do some debug prints of your shader variables to be sure you're sending it what you intend."

Thanks I'll try that!

Quote: "I also didn't notice in your code where you set the technique"

Nor does Evolved in the demo so I don't think that's it...

Quote: "Also, the shader is expecting 3 textures on the object"

This might be the problem as a) I don't know where DarkLights puts the lightmap and b) my model has multiple textures...

I might need to UV unwrap and use only one texture.

I've attached nearly finished basic model to an Email for you to have a go at (Don't want to give too much away for anyone who might play the game do I?)...

EDIT:
Quote: "
The following message to <info@nospamkistech.com> was undeliverable.
The reason for the problem:
5.1.2 - Bad destination host 'DNS Hard Error looking up nospamkistech.com (MX): NXDomain'
"


I've attached it here instead... (don't tell anyone)

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th Apr 2010 20:26 Edited at: 16th Apr 2010 20:43
I should have mentioned to remove the "nospam" from the domain. Prevents spam crawlers from grabbing my email address.

I have the file now if you want to remove it from your post.

[edit]

Ok, without digging into it to much, I would speculate that the multiple textures and the lightmaps aren't necessarily being applied to stages 0 and 1, or they may be in reverse order from that.

Try swapping the first two texture readers in the shader and see what happens.

Change..


To,


If that doesn't do it, you might have to play with the texture stages. That would probably be easier than trying to make those textures into one big one and then UV mapping the whole thing.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 16th Apr 2010 22:02
Thanks @KISTech, I'll give that a try.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th May 2010 11:27
A quick update: I've been messing around with the model as I go and I've applied the lightmaps manually and I can get it to work... partly.

Here is the code I'm using to apply the lightmaps (found in a GreenGandalf post I think):


The problem I now get is that some limbs loose their lightmaps when I apply the Flashlight shader to texture stage 2 while other limbs (in the same object) don't...

I have two possible solutions to this:
1-Apply the lightmaps and shader manually to each limb of the object that has mesh manually... (a bit of a pain)
2-Re-export each object with the mesh as a single limb... (a bigger pain)

...unless that is someone has a better solution?

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 5th May 2010 18:16 Edited at: 5th May 2010 18:17
In the set blend mapping on command, try changing the 4th parameter from a 0 to a 3. See what that does.

Also, if you are attaching other objects to those limbs, then yes, you have to apply the same blending to each of them.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th May 2010 18:31
Quote: "In the set blend mapping on command, try changing the 4th parameter from a 0 to a 3. See what that does."

No better I'm afraid...

It would help if all of these undocumented overloads could be added to the help files (but I'm just a whisper in the storm on that argument...)!!

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 6th May 2010 20:44
I know what you mean. It would be nice to know the default values on some of those parameters too.

Another thing I've noticed recently with models and lighting is the way that they are exported from the graphics app they are made in. I had some models yesterday that I processed through converting from Lightwave LWO files to DirectX files as I've done with other models before them, but no matter what I did I couldn't get them to react to light, and MilkShape wasn't very helpful in showing what the issue was.

So I loaded the converted .X files into Caligari gameSpace, then saved them back to .X, and that seemed to strip out something to do with the materials saved with the original model. The resulting model reacted to light as it was supposed to.

This condition, whatever it was, made the model stay the same brightness all around whether being lit by a DBPro light, or by a shader.

Maybe there's something about that part of the model that is textured differently or something.

Just a though...

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th May 2010 00:38
Thanks KISTech, I'm just downloading Truespace from Caligari.

Thanks for the thoughts and maybe it'll help. I might try some of the other software I have as well...

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 7th May 2010 18:07
TrueSpace is fantastic, although if you find their interface a bit daunting, gameSpace used their old interface which had a less steep learning curve. To bad they never supported it for more than a year before Microsoft closed them down.

Login to post a reply

Server time is: 2024-03-29 10:09:11
Your offset time is: 2024-03-29 10:09:11