a7zan

unknow problem with shader

13 posts in this topic

hello everyone,

i get problem when i'm make shader for cj 

the debugscript : http://imgur.com/Jhh5CXL

 

Code : 

addEventHandler("onClientResourceStart", resourceRoot, function()
shader = dxCreateShader("Shader.fx", 0, 0, false, "ped") 
texture = dxCreateTexture("Head.jpg") 
dxSetShaderValue( shader, "Ped", texture )

ped = createPed(0,2343.26978 ,-1711.83752, 13.35361)
  engineApplyShaderToWorldTexture(shader, "cj_ped_head",ped)
end)

  

 

Shader.fx

texture Ped; 
technique simple { 
    pass P0 { 
        Texture[0] = Ped; 
    } 
} 

 

Share this post


Link to post

I've no clue about shaders, but this is what I normally use

texture Ped;

technique J
{
    pass P0
    {
        Texture[0] = Ped;
	DepthBias=-0.0002;
    }
}

If that fails, can we see your meta.xml?

Edited by LopSided_

Share this post


Link to post

some problem

maybe problem from meta ?

<meta>
<script src="Server.lua" type="server" />
<script src="Client.lua" type="client" />
<file src="Shader.fx" type="client"/>
<file src="Head.jpg"  />




</meta>

 

Edited by a7zan

Share this post


Link to post

Change line number 4 to

<file src="Shader.fx" type="client"/>

And try again.

Share this post


Link to post

509409211.png

 

:|

Everything works well with me !!

Edited by !#NssoR_)
1 person likes this

Share this post


Link to post

LOL

why its not work with me ? 

i will try re-install

Edited by Dutchman101
removed useless mention

Share this post


Link to post

Something problem? Ok, try to fix something by doing something in the code.. Rather than saying there's something wrong, can you just tell us what the problem is exactly?

Share this post


Link to post
28 minutes ago, pa3ck said:

Something problem? Ok, try to fix something by doing something in the code.. Rather than saying there's something wrong, can you just tell us what the problem is exactly?

-___- 

it's work with @!#NssoR_) but with me no , i don't know why !

i change the shader file and some problem

look the debug http://imgur.com/Jhh5CXL

Share this post


Link to post

It looks like dxCreateTexture("Head.jpg") is failing

Is the actual file called Head.jpg or head.jpg ?

 

Share this post


Link to post

I was wrong about Head.jpg.

The problem is Shader.fx is encoded as UTF-8-BOM, and needs to have the BOM removed. To do this with notepad++:
1) Open Shader.fx in notepad++
2) Select Encoding->UTF-8
3) Save

2 people like this

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.