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.

AppGameKit Classic Chat / Any info on writing agk shaders?

Author
Message
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 16th Mar 2013 13:38
Quote: "I tested the code and used a lights direction and the result is only weird"


ha ... same thing here lol
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 16th Mar 2013 18:33
Not sure if there are simpler ones. All the specular lighting codes I've seen involve increasing the light at an angle from the light via the object back to the camera

My hovercraft is full of eels
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 17th Mar 2013 10:41
Quote: "Cliff Mellangard 3DEGS

I tested this in the vertex shader and it works on both android and computer

texcoord = uv*vec2(1.0,1.0)+scrollit;

the vertex shader neads an uniform called uniform vec2 scrollit;

And in agk do you simply scroll it like this.

SetShaderConstantByName( myShader, "scrollit",scroll# ,0.0,0, 0 )
scroll#=scroll#+0.02

if you want to scroll in 2 directions.
SetShaderConstantByName( myShader, "scrollit",scroll# ,scroll#,0, 0 )
scroll#=scroll#+0.02
I hope it helps "


I use this now: uvVarying = uv * uvscale + uvscroll;
Where uvscale and uvscroll are vec2's, so it's clearner. Thank you Cliff

But to the issue of android, the problem seems to be that the plane is a completely different size than on PC.
How this is setup is I have an image that is 1500x350 pixels, I made a plane in scale 50x35, and then set the scale of my shader to 0.333 which makes the texture three times bigger. Then scrolling it, and it looks like three frames switching place, just like an animated sprite. See youtube link earlier in thread.

So when the android creates a plane with a different size the scale is off, and it looks like this is the issue right now. Going to keep testing.

My hovercraft is full of eels
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Mar 2013 13:07
Quote: "I use this now: uvVarying = uv * uvscale + uvscroll;
Where uvscale and uvscroll are vec2's, so it's clearner. Thank you Cliff

But to the issue of android, the problem seems to be that the plane is a completely different size than on PC.
How this is setup is I have an image that is 1500x350 pixels, I made a plane in scale 50x35, and then set the scale of my shader to 0.333 which makes the texture three times bigger. Then scrolling it, and it looks like three frames switching place, just like an animated sprite. See youtube link earlier in thread.

So when the android creates a plane with a different size the scale is off, and it looks like this is the issue right now. Going to keep testing."


I actually already do this in my dungeon game
This function is done in agk already by using a atlas texture.
I simply switch subimages on my plane.
Could be an solution until they fix some of the shader issues.
I really dont know why it behaves like this for you on android ?

Quote: "So when the android creates a plane with a different size the scale is off, and it looks like this is the issue right now. Going to keep testing."

But i belive this is an issue with not being an power of 2 image?
Try an image that is 512x512 or 1024x1024 and see if there still is an issue

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 17th Mar 2013 14:32
True enough. And I thought of switching subimages but thought it might be a bit faster through the shader

I'll try with a different image size!

Thank you for your input mate

My hovercraft is full of eels
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 19th Mar 2013 04:48 Edited at: 19th Mar 2013 04:56
I've been looking into shaders, and at a load of shaders in this thread and online to try and understand what's going on. I took this shader I found online and tried to apply it to an object but it doesn't have the effect i expected. No glowing aura around the object (like this - Linky).



Does the shader just not do what I expected it to do or am I doing something wrong?

Am i supposed to define the referenceTex somehow?

EDIT: Forgot to paste the shader code
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 19th Mar 2013 16:28 Edited at: 19th Mar 2013 16:29
Quote: "I took this shader I found online and tried to apply it to an object but it doesn't have the effect i expected"


What you have there is a full screen shader, which is something we don't yet support but I hope to add when I get back to the 3D commands.

Quote: "I think you'd have to send camera-information in setShaderConstantByName to a vec3 or vec4 called viewdirection in this case"


Correct, a specular shader requires the camera position which you can then use to get a view direction to each pixel for the equation. AppGameKit will send this value automatically at some point in the future.

Quote: " I have an image that is 1500x350 pixels"


You will have to be careful with Android and iOS devices when using non-power of two images since they will be padded with black up to the next power of two. So what you're really dealing with in this case is a 2048x512 image with UV coordinate modifiers in uvBounds0 to shift the 0.0-1.0 UV coords onto the actual non-padded image.

If you use power of 2 images then you have a lot more flexibility and can ignore the uvBounds0 parameter entirely.
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 19th Mar 2013 16:39
Thanks Paul. It's sometimes the blind leading the blind in here but we make progress Nice that you monitor this thread.

(by the blind I mean primarily myself, no offense meant to anyone participating in this thread)

My hovercraft is full of eels
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 20th Mar 2013 05:07
Quote: "What you have there is a full screen shader, which is something we don't yet support but I hope to add when I get back to the 3D commands."


I don't want to seem rude or demanding, but when might that be?
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 20th Mar 2013 09:38 Edited at: 20th Mar 2013 09:40
Quote: "Does the shader just not do what I expected it to do or am I doing something wrong?

Am i supposed to define the referenceTex somehow?"



Yes, I think they refer to the texture of the object you are getting the colors from to distort, so replace referenceTex with texture0 which is the image you place on your object with:
SetObjectImage( objID, imageID, texStage )
where texStage would be zero for normal texturing. However if you are taking your bloom-values from a lightmap or such you could use texStage from 1 to 7 and the use "texture1" in the shader.

I believe so anyway

My hovercraft is full of eels
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 20th Mar 2013 15:00
Quote: "I don't want to seem rude or demanding, but when might that be?"


3D commands are next on the list after 108 is finished, so hopefully not long.
wargasmic
17
Years of Service
User Offline
Joined: 15th Oct 2006
Location: UK
Posted: 27th Mar 2013 04:08
Define not long

Sorry just can't wait for this feature.
Jukuma
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: Germany
Posted: 28th Mar 2013 00:07
Very much useful information.

Nice Thread
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 3rd Apr 2013 00:49
How do I pass a texture to this shader?

I already tried to set the texture0 to the object and is OK without shader. I used texture0 as it is supposed to be the AppGameKit name for this?

n.b. this is a demo from shadertoy (water effect)



Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 3rd Apr 2013 01:11
Have you tryed

precision highp float;
uniform sampler2D texture0;

I Think anything should be passed after this in to the shader?

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 3rd Apr 2013 01:27
I mean, from my AppGameKit code..

lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 3rd Apr 2013 02:25 Edited at: 3rd Apr 2013 02:26
Any other than SetObjectImage( objID, imageID, texStage ) ?

Where "uniform sampler2D texture0;" would be texStage = 0.

Or do you mean the "time" you need to increase in the shader from AppGameKit?
That you do with:


where "myShader" is the variable to which you loaded your shader.

My hovercraft is full of eels
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 3rd Apr 2013 02:47
tried that.

So do I pass a texture to the shader or pre-set the object? Seems the shader wants a texture?

lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 3rd Apr 2013 20:28 Edited at: 3rd Apr 2013 20:29
setObjectImage sets the texture and setObjectShader sets the shader, that's it.

I haven't looked closely at the shader yet, I haven't had any time, but I can see some things right away.
For instance:

is there in the default shaders and is added in the gl_FragColor calculation to get the color of the texture. I think you should look at the default shaders and try to incorporate the calculations from the shader you want to use.

My hovercraft is full of eels
Weave
AGK Bronze Backer
17
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 6th Apr 2013 04:42
Hey can anyone tell me how to make the .ps and .vs shader files that I`m assuming go in the media folder? Are they renamed text files or is it that I have to export them from FX composer or something? Is it explained in the AppGameKit book? Thx
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 6th Apr 2013 09:22 Edited at: 6th Apr 2013 09:23
Quote: "Are they renamed text files "

Yes they are
Its the ending of the file that lets agk now wath they are,vertex or ps that is.

Keep in mind that pixel shaders are many times called fragment shaders.

This is how you load a shader in agk.

#Constant BasicShader 1
LoadShader( BasicShader, "shaders/VertexBasicFog.vs", "shaders/PixelBasicFog.ps" )

I use a folder called shaders in the media folder.

I many times use a constant for a shader id as it mostly never change.

This is how you convert an agk color value in to a shader.

BaseValue#=1.0/255.0
shaderRed#=BaseValue#*red
ShaderGreen#=BaseValue#*green
ShaderBlue#=BaseValue#*blue
SetShaderConstantByName( BasicShader, "agk_fogColor", shaderRed#, ShaderGreen#, ShaderBlue#, 1.0 )

Hope it helps.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Weave
AGK Bronze Backer
17
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 6th Apr 2013 16:52 Edited at: 6th Apr 2013 17:58
Ah thanks, so before I posted I had made text files, renamed them "vertexshader.vs" and "pixelshader.ps" in my media folder, then my AppGameKit reported that of the two in loadshader(ID,vertexname,pixelname) it couldn`t compile my pixelshader file(note that it didnt report that for the first of the two terms, only the second pixelshader name)....so looking at my self made text files .vs and .ps I see that Windows8 thinks they are called "vertexshader.vs.txt" and "pixelshader.ps.txt"

SO...is my problem how to correctly rename these two files in Windows8

Maybe making them from my Vista laptop will help....or can someone put empty working ones` as a download....

Thx

EDIT: yes, even now in a `shaders` folder it seems to actually compile the vertex shader even though I ask for `shaders/vertexshader.vs.txt`, but the crash reports that the "shaders/pixelshader.ps.txt" could not compile. Could it be my 9800GT card shader model?

But these filenames look a little wrong in the line:-
loadshader( 1, "shaders/vertexshader.vs.txt", "shaders/pixelshader.ps.txt" )

?
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 6th Apr 2013 18:23 Edited at: 6th Apr 2013 18:24
simply use note pad and write the file name with an .ps or .vs so should win not write anymore extensions.
But i use win 7.

This is wath i know on androidphones................
That your shader fails can be absolutely anything because if you simply misses and writes 1 instead 1.0 at some Place so will it crash.

Or you write light when it should be Light.

Shaders are many times sensetive if an value gets under 0.0 and can cause a crash.

Its many time trial and error but fun when you understand it some more.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Weave
AGK Bronze Backer
17
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 6th Apr 2013 20:13 Edited at: 6th Apr 2013 20:19
Ah, ok thanks, but I copied an example from the other AppGameKit shader thread so was assuming them to be working, but as I said the vertex shader seems to compile despite what I call it from the loadshader command ie "vertexshader.ps" or "vertexshader.ps.txt" and the compiler reports only that the second call pixel shader file hasn`t compiled.

The only mistake in the pixelshader code I can see is :-

vec4(color,1)

which by your estimation should perhaps be :-

vec4(color,1.0)

...but alas it still reports the pixelshader will not compile, oh and I see it was your pixel shader code too Cliff Mellengard, so having done as you suggested I remain somewhat perplexed.


EDIT:Actually I have to ask for :-

loadshader( 1, "shaders/vertexshader.vs.txt", "shaders/pixelshader.ps.txt" )

Then it loads the vertex shader, seemingly compiles it, loads the pixel shader, but fails to compile it.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 7th Apr 2013 17:03 Edited at: 7th Apr 2013 17:05
Quote: "vec4(color,1)"

This should be like this i whas meaning in calculations.

diff/1 is wrong
diff/1.0 is right
Quote: "...but alas it still reports the pixelshader will not compile, oh and I see it was your pixel shader code too Cliff Mellengard, so having done as you suggested I remain somewhat perplexed."

Wath shader and on wath device ?

I have some old ones that might not compile on android as i didt know then about case sensetive stuff when i wrote them.

I started this thread while Learning shaders so many are old and might not work on the droid.
I havent deleted them as they have some usefull data

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Weave
AGK Bronze Backer
17
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 7th Apr 2013 20:53 Edited at: 7th Apr 2013 21:02
Oh, ok so the colour integer isn`t a calculation so is accepted as simply 1
but will it fail if it is 1.0, I guess thats where the experimentation comes in, but until I can compile my .ps I cant tell.

I copied the text from the first example in this very thread as the contents of my .vs and .ps files.

I have a six*3.3 core Win8 pc which has currently a nVidia9800GT dx11 installed along with dx9.0c (as far as I know its only a dx10 card, have some issues in darkBasicPro admittedly since the Win 8 upgrade ie my bloom quads aren`t right transparency so dont work, my characters shadows don`t work and Blitzterrain objects will no longer show...but that`s not really relevant here, but there you go)

Have you a working .ps and .vs that I can test here?
Weave
AGK Bronze Backer
17
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 8th Apr 2013 18:25
Well I got a "lilpissywilly(Posted: 13th Mar 2013 23:44 Edited: 14th Mar 2013 15:45)" .vs and .ps to compile...hurray, but it`s an animating texture shader so my self-made object is all textured flat black, perhaps I have to get the lighting right or texture0 and texture1, but at least it compiles. Seems some deeper investigation is in order

Incidentally, to get them to compile here in Win8 I have to call:-

loadshader( 1, "shaders/vertexshader.vs.txt", "shaders/pixelshader.ps.txt" )
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 8th Apr 2013 23:39 Edited at: 8th Apr 2013 23:39
If you replace "uvVarying = uv * enduv.xy + vec2(startuv.x, startuv.y);" line
with "uvVarying = uv * uvBounds0.xy + uvBounds0.zw;" in the vertex shader of my animated texture shader;

then you have the default AppGameKit shader for 1 texture (texture0), 1 point light and 1 directional light

Play away

My hovercraft is full of eels
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 9th Apr 2013 00:24 Edited at: 9th Apr 2013 00:24
Good willy could help you as i mentioned earlier so do i sadly have my hands full at the moment

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Weave
AGK Bronze Backer
17
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 10th Apr 2013 06:01
Yes!... I replaced that line, then realised I hadn`t got my normals exported on my model and now I have default light behaviour on my own model....looks GREAT thx
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 12th Apr 2013 00:30
Something i just learned and want to share as it whas extremely irritating when trying to get my own game to run on a tegra 2 device.


Nivida tegra 2 devices demands that you pass in your own values from agk thru the vertex shader first and then to the fragment/pixel shader with an varying.
This is if you do your own fog shader etc.
And want to pass in an min and max value to the fragment shader.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 12th Apr 2013 16:35
Good work Cliff, keep it up

My hovercraft is full of eels
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 9th May 2013 22:19 Edited at: 10th May 2013 00:21
Got a problem with trying to get a lightmap shader to work.
When I try different lightmap images the objects either are lit up or darkened, the whole thing. One really odd thing is when I switch texture image with a timer on one object where I tried the lightmap, the different texture images are shaded differently.

The shader:
Vertex:



Fragment:


I took it from the 3D example in AGK. But I can't see anything wrong with the actual shader.

Heeeelp

Edit: To clarify:

lightmap image, 64x64 png, one half white, one half black.

If I do this:


The difference in shade shows up at image 5. As if.. yeah


Edit 2:

Also tried the pixel shader like this:



It acts exactly as if texture1 is like 8 times larger than texture0

Edit 3:

Doesn't this just feel wrong? From the vertex shader:


I mean it should still work, but what's the point of calculating the same thing twice..

Edit 4: Fixed it! Thanks everyone for being my therapist!

Edit 5:
Might as well share the lightmap shaders I'm using:

Vertex:


Note here, uv1 doesn't work, which was probably what caused the whole thing to not work.

Pixel:


My hovercraft is full of eels
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 10th May 2013 14:44
i whas away for last night and this morning but good you solved it your self

Its no better Learning experience then to solve a problem

And as you experienced so is the uv in the vertex shader for the object and the same on all textures.
so wathever the amount of images on an object does it use uv and not uv1,uv2,uv3 etc.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 10th May 2013 19:43
The cute part is, that was TGC's shader from the 3D example shipping with AGk

So beware TGC, broken shader in your 3D example

My hovercraft is full of eels
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 16th Jun 2013 08:45 Edited at: 16th Jun 2013 08:49
Quote: "When I try different lightmap images the objects either are lit up or darkened, the whole thing. "


I've noticed this too, so I gave your fixed shader a try. Unfortunately, something is going quite wrong.

Here's how it should look:



But here's how it turns out instead:



The actual AppGameKit code is to long to post, but it basically goes like this:



Do you possibly know why this is happening?

Sean

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 16th Jun 2013 15:24
I dont have fpsc installed or the map convertor.

But with an Quick glance at the sample with agk so is there a custom subimages file that could be for the map sgments light maps.

I simply suggest that you guys ask the creator of the map convertor to fix any issues with fpsc maps in agk.

The sample whas done in an differrent way then the later released map convertor?

Hockey your images show that it textures the whole light map on every segment and not the parts it should do.

You nead to write a function to set the right subimages of the lightmaps on to each segment.

This is something they probably do with the custom lightmap file ?

Iam sucessfully using both lighmaps,point lights in van b and my own Project.
Where the lightmap is a part of the main diffuse texsture.
But my map,engine and Everything is written from scratch and do not solve any issues with fpsc maps.
The extra uv could be neaded for fpsc maps to get right lighmaps but i really dont know as i havent played around with them ?



Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 16th Jun 2013 21:12
Quote: "I dont have fpsc installed or the map convertor."


I'm actually not using the converter, I wrote a lightmapper in DBPro using DarkLights.

Quote: "Hockey your images show that it textures the whole light map on every segment and not the parts it should do."


That's interesting, I'll have to debug my code. But each lightmap should be getting applied to the proper object.

Sean

basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 16th Jun 2013 23:05
does anyone know about a good book to learn how to write shaders for AGK.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Jun 2013 00:00 Edited at: 17th Jun 2013 00:00
Quote: "does anyone know about a good book to learn how to write shaders for AGK."


There is one that rule them all

Opengl es 2.0 programming guide by munshi,ginsburg and shreiner.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 17th Jun 2013 02:12
Hi Cliff,

I ran some tests and noticed that using lilpissywilly's shaders on the 3D example that comes with AppGameKit produces the same issue. Do you happen to have any idea why?

Sean

haliop
User Banned
Posted: 17th Jun 2013 04:20 Edited at: 17th Jun 2013 04:28
Cliff Mellangard 3DEGS


i have a small suggestion about your game..
when you shoot an enemy with the fire ball or any other ranged wepon of any kind... please you must do it the game will benefith alot from



is there any link to your game?

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Jun 2013 18:24
Quote: "Hi Cliff,

I ran some tests and noticed that using lilpissywilly's shaders on the 3D example that comes with AppGameKit produces the same issue. Do you happen to have any idea why?

Sean"


Wath i can make out off the sample so does the uv that willy thought whasent used actually being used by the lightmap.
and all the obj files in the sample have an material assigned in them.
I belive you guys have to ask tgc as i have no clue?
custom is simply the font


Haliop.
Our game is completely done in agk 3d but we use billboards and simply planes we animate.
Check the showcase as we will release an demo soon.
Its called eat drink slay.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 18th Jun 2013 02:39
Quote: "I've noticed this too, so I gave your fixed shader a try. Unfortunately, something is going quite wrong.

Here's how it should look:"


It looks like the model is only using one set of UV coords for both the diffuse and lightmap textures. Was this loaded from an OBJ file with two sets of UV?
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 18th Jun 2013 04:31
Quote: "It looks like the model is only using one set of UV coords for both the diffuse and lightmap textures. Was this loaded from an OBJ file with two sets of UV?"


Actually the lightmapper that I wrote only loads in .x files (since I wrote it in DBPro). So when exporting the models from Blender, they were exported as both .x and .obj. I used the .x for the lightmapper and the .obj for AGK.

I've attached the map files (including the lightmaps ) to this post, hopefully you can take a look at them.

Sean

Attachments

Login to view attachments
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 23rd Jun 2013 09:51
Quote: "Was this loaded from an OBJ file with two sets of UV?"


Does OBJ even support more than one set of UVs? When converting from .dbo to .obj, the second set of UVs for lightmaps doesn't seem to get carried along.

Sean

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 24th Jun 2013 18:14
We added a hack for the "vt" lines where if you had 4 values it would take the first 2 as the first set of UVs and the second two as the second set of UVs
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Nov 2013 23:27
Bit of a big bump here, but I'm trying to create a "shiny floor" that reflects the objects in a room. But where do I start? I've been looking around the interweb but I got very lost.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 20th Nov 2013 23:40
I belive you nead the new akg 2 shader commands for that?
If iam not mistaken so do you nead an full screen shader to create an mirror fx.
Or simply the render to image command it seams to have

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
CodeMonkey
11
Years of Service
User Offline
Joined: 6th Mar 2013
Location: Ireland
Posted: 15th Jan 2014 15:32 Edited at: 15th Jan 2014 22:48
I've just started with GLSL and I can't seem to get anything other than ambient lighting to work :/ Can anybody tell me what is wrong with my code? I'm trying to set up per pixel diffuse lighting..

Vertex


Pixel


EDIT:
After hours of changing code to try to figure out where my mistake was I realized that by default Blender didn't export Normals. So I ticked the box when exporting and all is good

Login to post a reply

Server time is: 2024-05-08 06:18:31
Your offset time is: 2024-05-08 06:18:31