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 / White model when I change its shader in game

Author
Message
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 10th Jul 2012 18:13
Hi, I want to make a thermal vision but I've a problem.
At firt, my character seems okay, when I enable thermal vision, it works too.
But when I disable thermal vision, the model is white and I can't texture it

Can you help me please ?


This is the code :



Eternal suffering ...

I'm french
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th Jul 2012 18:19 Edited at: 10th Jul 2012 18:20
I think this turns an effect off.... set object effect objNo, 0

Then you can use textures.

Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 10th Jul 2012 18:22
It doesn't works

Eternal suffering ...

I'm french
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 10th Jul 2012 18:28


You also forgot the () brackets on your second function.

TheComet

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th Jul 2012 18:32
After you turn off the effect try using the full version of the texture command.........texture object ObjNo,0,Texture.

The extra zero chooses the diffuse texture.

Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 10th Jul 2012 18:37
@TheComet: Oops, thanks for the brackets. I've tried the "set shading off" commands, my model has always the rainbow texture but if I texture it with his original texture it become white

@Pincho Paxton: I'll try it.

Eternal suffering ...

I'm french
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 10th Jul 2012 18:42 Edited at: 10th Jul 2012 18:43
It doesn't work

Eternal suffering ...

I'm french
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 10th Jul 2012 18:49 Edited at: 10th Jul 2012 18:50
You don't have to texture it again because it already has the texture. We're trying to look for a way to turn off the shader. I thought that was the command, but apparently not. I can't find anything else.

[EDIT] Does this work?



TheComet

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th Jul 2012 18:56 Edited at: 10th Jul 2012 18:57
Quote: "You don't have to texture it again because it already has the texture."


In a recent project I had to re-texture a model after I turned the shader off. But I used the commands that I posted.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Jul 2012 22:36
This doesn't look right to me. Did you really intend to texture the object with the object ID - or are they in fact the same?



Otherwise I agree with what Pincho Paxton has been saying.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 10th Jul 2012 22:58
@GreenGandalf: They are the same.

@TheComet: It doesn't work too

Eternal suffering ...

I'm french
Daniel wright 2311
User Banned
Posted: 10th Jul 2012 23:17 Edited at: 10th Jul 2012 23:18
What format is the model? is it a .obj? .X OR A .DBO, If you save your object with its textures applied as a .dbo,it will save all of the texture info for that modle.

Then when you load in the model,you dont texture it,it will find the texture on its own solving your problem. save your model as a .dbo one time,then just use that .dbo.

if file exist("mynewobject.dbo")=1 then delete file "mynewobject.dbo"
save object "mynewobject.dbo",SecondObject

my signature keeps being erased by a mod So this is my new signature.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 10th Jul 2012 23:19
Its a .x, but in a blank project (recreating this situation) it works o_O

I'll try with dbo, but I think the problem is in my engine

Eternal suffering ...

I'm french
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 10th Jul 2012 23:41
It doesn't work too, the problem must be in an other part of my code

Eternal suffering ...

I'm french
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Jul 2012 23:50
Hell_666

I've just checked one of my old demos and I have exactly the same problem as you. I'm sure it used to be the case that you used an effect ID of 0 so either this is a new bug or something else has changed. I'll do a bit more investigating and report back.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 10th Jul 2012 23:55
Thanks, but I don't use 0 as effect ID

Eternal suffering ...

I'm french
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 00:01
I know - but that was Pincho Paxton's advice which I agreed with.

As I said, I'm sure that used to be the way to turn a shader off before applying a new one.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 00:04
Okay, I see. But when I don't apply a new shader (I only use texture object to disable the shader) I've the same problem

Eternal suffering ...

I'm french
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 00:15
Yes, I know and I'm baffled too. I'm trying to find the original source of Pincho's suggestion but have failed so far - I thought it was a query posted by Scraggle many moons ago but it's possible it was buried in another thread. I'm still searching though.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 00:17
Ok, thanks

Eternal suffering ...

I'm french
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 00:41
It's strange, I've inserted something like this into my loop :



But when I press the return key, the model become white o_O

Eternal suffering ...

I'm french
Daniel wright 2311
User Banned
Posted: 11th Jul 2012 00:41
Well,ok, I did this myslef with no problems, I even changed textures with diffrent shadders with no problems in the loop. It must be something in your code realted to the same texture number,or shader numbers.

my signature keeps being erased by a mod So this is my new signature.
Daniel wright 2311
User Banned
Posted: 11th Jul 2012 00:43 Edited at: 11th Jul 2012 00:44
Do this,

if texturemode=0 then texure object idobj,idtex

if texturemode=1 then texure object idobj,idtex

if texturemode=2 then texure object idobj,idtex

if returnkey()=1 then inc texturemode

if texturemode>2 then texturemode=2
if texturemode<0 then texturemode=0

my signature keeps being erased by a mod So this is my new signature.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 00:45 Edited at: 11th Jul 2012 00:47
I don't understand what your code must to do ...

Edit: oops, bug, I've not see all your code ^^ I'm going to try this

Eternal suffering ...

I'm french
Daniel wright 2311
User Banned
Posted: 11th Jul 2012 00:47
It changes your texture due to what texture mode you are in

my signature keeps being erased by a mod So this is my new signature.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 00:50
I don't understand what do you mean by texture mode, I use one texture, else one shader

Eternal suffering ...

I'm french
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 00:55 Edited at: 11th Jul 2012 00:58
Hmm...? I've just found my old demo of how this should work - and it does. Perhaps it's something to do with the shader or object themselves? My demo uses simple spheres.

I haven't found the post by Scraggle but did find this thread which seems to report somewhat conflicting results by various people:

turning off shaders

The suggestion to use a dummy technique in the shader might be worth trying - see the post by Jna99 about half way down the thread - but that doesn't seem to work for me either now. I don't know what the key difference is.

I haven't got time to delve further into this now but I wonder whether it has something to do with the number of textures applied - the one which works has just one and the one which doesn't has two. Perhaps DBPro doesn't reset correctly when there's more than one applied? [Edit Just seen the other posts (I took too long to compose my reply again ). Seems that isn't the explanation either.]
Daniel wright 2311
User Banned
Posted: 11th Jul 2012 00:59 Edited at: 11th Jul 2012 01:00
your texture mode is set up with your own code,just saying this

if texturemode=0 then texure object idobj,idtex

this sets a state for your texture,even if it is just one texture

the states will hold your texture in place,it should

my signature keeps being erased by a mod So this is my new signature.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 01:06
Model is white ...

I think the problem happen when I texture the object

@Green Gandalf: I'm looking at the thread, but it deals with disabling shader on an object, I can do this with "texture object command" but in fact I think there is a problem when the texture is applied, so my model has no texture data

Eternal suffering ...

I'm french
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 01:23
Quote: "I'm looking at the thread, but it deals with disabling shader on an object, I can do this with "texture object command" but in fact I think there is a problem when the texture is applied, so my model has no texture data "


Yes, that's what I seem to be getting but not all the time, some demos work correctly, others don't. Could you post a simple example of a shader that has this problem? I might be able to spot a pattern - not till tomorrow though.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 01:26 Edited at: 11th Jul 2012 17:03
I use the rainbow shader of dark shader (I've just modified colors):



EDIT: I've the same problem with other shaders

Eternal suffering ...

I'm french
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 02:18
Here's a simplified version of mine which works - attached. Just press "t" to turn off the shader.

Will try your shader tomorrow.
Daniel wright 2311
User Banned
Posted: 11th Jul 2012 03:00 Edited at: 11th Jul 2012 03:01
Your trying to change your effect shader yes? then after you apply a new one you have to retexture your model before hand,this is something i learned a long time ago,this is why I used diffrent states to my model for bolth,retexturing,then appling the new shadder.

First you texture your model,then apply a shadder to it,this is why your model is white when you change the shadder as your tital states.

SO then,we change the texturemode so we can change shadders to the object,you are still going to have to re texture it before appling the new shadder.

my signature keeps being erased by a mod So this is my new signature.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Jul 2012 05:59 Edited at: 11th Jul 2012 05:59


I don't see how that should do anything smart? You're just running the same command every time which makes the whole incrementing and checking useless. This does the same as your code:



And that's useless as well

TheComet

Daniel wright 2311
User Banned
Posted: 11th Jul 2012 06:32 Edited at: 11th Jul 2012 06:33
well you have to rename each texture,even if it the same texture,it still insures the model to get re textured in the end.

So mabey something like this

if texturemode=0 then texure object 1,1

if texturemode=1 then texure object 1,2


if returnkey()=1 then inc texturemode

if texturemode>1 then texturemode=0
if texturemode<0 then texturemode=0

Im just trying to help If I can,Ive had the same problem,and this is how I worked it out

my signature keeps being erased by a mod So this is my new signature.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 11th Jul 2012 10:23
By the way, I haven't upgraded my DBPro to 1.077 it's 1.075.

Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 11:59 Edited at: 11th Jul 2012 12:02
@Green Gandalf: Your code works for me, with my shaders too, but on my engine it doesn't works
I don't understand where the problem can be happened, I only know it happens when I disable shader or I texture my object.

@Daniel Wright: I don't think using 2 texture id can change my problem, I've tried to delete and reload the texture, but it has not solved the problem.

I'll see in my code where it could interfer

Eternal suffering ...

I'm french
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 13:48
Quote: "I don't understand where the problem can be happened, I only know it happens when I disable shader or I texture my object."


Yes, I'm baffled too and haven't yet discovered the key thing which triggers the problem.

Here's my demo which fails like yours.

Notice that if you press 1 and/or 2 to remove the shaders then press 4 to reinstate them you find that the green image has been correctly applied to stage 0 and that the normal map is still applied to stage 1.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 15:25
I see, the problem is the same, really strange

Eternal suffering ...

I'm french
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Jul 2012 15:55
This is just a thought, but objects without shaders essentially use a "shader" as well right? Would it be possible to make a shader like that and apply it to the object to disable the effect?

TheComet

Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 16:35 Edited at: 11th Jul 2012 16:36
I have tried a shader that simply apply a texture to an object, but I have the same result: white model ...

The shader is not the main factor of this problem, with an other code, it works, so I think it happen due to an other factor

With 3 demos different, only one works with all shaders I've tested, but the 3 do the same thing (but the code is a litle different), it's very strange. I'm seeing differences on this sources and I'm making some test, but for the moment I've no results

Eternal suffering ...

I'm french
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 16:57
@Green Gandalf: Try with it and look at the result, I don't understand how it can be happen o_O



Eternal suffering ...

I'm french
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 20:21
Quote: "This is just a thought, but objects without shaders essentially use a "shader" as well right?"


Not in DBPro - in most situations the non-programmable fixed function pipeline of DirectX 9 is used.

Quote: "Would it be possible to make a shader like that and apply it to the object to disable the effect?"


The simple way of doing that is to have a default technique which simply sets all the pipeline states that DBPro normally sets up for you. It's a bit inflexible though. I haven't tried it yet - another quiet evening gone I suppose .
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 20:45
Hell_666

Forgot to check next page before posting.

I'll check your new snippets now.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 20:50 Edited at: 11th Jul 2012 21:09
Quote: "@Green Gandalf: Try with it and look at the result, I don't understand how it can be happen o_O"


Yes, that is a workaround. You have deleted the problem object and started again with a clean copy of the object.

This looks like some sort of bug to me. Applying a new shader seems to work though - at least in the cases I tried.

Edit

Quote: "The shader is not the main factor of this problem, with an other code, it works, so I think it happen due to an other factor"


I think you're right - but what that magic factor is I've no idea . Something behind the scenes hasn't been restored correctly is my guess.

Edit2

I've just asked Lee about this and he agrees that set object effect objID, 0 should work so this does indeed sound like a bug. I'll post a bug report this evening.

In the meantime I suggest you use whichever workaround is most convenient for you.
Daniel wright 2311
User Banned
Posted: 11th Jul 2012 21:42
Quote: "I don't think using 2 texture id can change my problem, I've tried to delete and reload the texture, but it has not solved the problem."


Its not about using 2 dirrent textures,its about replacing the texture after resetting the shadder,but if it works out side of your other code,then it has to be something else with in your code.

my signature keeps being erased by a mod So this is my new signature.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 21:46
Quote: "then it has to be something else with in your code."


I'm fairly sure it isn't his code. What do you think is wrong with the example I posted a few posts back?
Daniel wright 2311
User Banned
Posted: 11th Jul 2012 22:36
Quote: "What do you think is wrong with the example I posted a few posts back? "


I can not find it,can you repost it?

my signature keeps being erased by a mod So this is my new signature.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Jul 2012 23:06
Look again. It's near the bottom of page 1. The zip file is "turn off shader problem.zip" posted about 10 hours ago.

I've also just posted a bug report which investigates this issue in a bit more detail.

Hell_666 I hope you don't mind - I used your rainbow shader as one of the examples in the bug report.
Hell_666
16
Years of Service
User Offline
Joined: 11th Jul 2009
Location: France
Posted: 11th Jul 2012 23:10
@Daniel Wright : It's in this post : http://forum.thegamecreators.com/?m=forum_view&t=198522&b=1&msg=2373211#m2373211


@Green Gandalf: It's not my own shader, I've just modified it a litle, it provide from Dark Shader ^^

Thanks for your hard work to help me, I enjoy it a lot

Eternal suffering ...

I'm french

Login to post a reply

Server time is: 2026-07-07 21:51:23
Your offset time is: 2026-07-07 21:51:23