![]() |
|
Iso 2D engine using CG Shaders [video] |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Dario ff said: Try out the glslf profile. This time after the black screen I got a white screen with a dark grey rectangle with a cutout on the bottom of the screen. F5 showed an isometric diamond outline on the screen. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dario ff
Member #10,065
August 2008
![]() |
Yup, it seems again, my code never builds on an ATI GPU! I'll be able to debug this later more properly with a friend, so don't worry. It'll work, it's just that there are always some quirks I forget. EDIT: Yeah, I did the same stupid mistake I did once of mixing up ints and floats. NVidia GPUs are more forgiving in that, and it's been nearly an year from using these that I forgot, sorry. Wait for take #2. TranslatorHack 2010, a human translation chain in a.cc. |
AMCerasoli
Member #11,955
May 2010
![]() |
Dario ff said: Yup, it seems again, my code never builds on an ATI GPU! I'll be able to debug this later more properly with a friend, so don't worry. It'll work, it's just that there are always some quirks I forget. Yes yes yes... I want my money back.
|
Dario ff
Member #10,065
August 2008
![]() |
Try out these two shaders if you want. They're pretty horrible at the moment regarding optimizations obviously, but I didn't really expect to even put something like it online. TranslatorHack 2010, a human translation chain in a.cc. |
kenmasters1976
Member #8,794
July 2007
|
Wow! this looks really impressive!. I thought it was 3D until that part where you say it's 2D. Actually, I could've bet that it's 3D. Nice work!.
|
GullRaDriel
Member #3,861
September 2003
![]() |
Does not work there. And the good news is that it's running at my display refresh rates ;-) "Technique lighting did not validate. Skipping." Edit: BTW I have a Radeon 5470 and MediaPlayerClassic let me play with it's shaders without problems. I use the latests drivers, 10.12, on W7 64. "Code is like shit - it only smells if it is not yours" |
Vanneto
Member #8,643
May 2007
|
Works here: nvidia geforce 8600GT. EDIT: Forgot to say: awesome. In capitalist America bank robs you. |
Dario ff
Member #10,065
August 2008
![]() |
GullRaDriel said: Does not work there.
Did you try the shaders I attached in the last post? Those fixed the problem I had with seeing just a white texture in an integrated 6100GT. Of course, it works incredibly slow, because it's a very crappy card. Of course, it could be that it's still not compiling on ATI, but I can debug that one more in detail later. kenmasters1976 said: I thought it was 3D until that part where you say it's 2D. Actually, I could've bet that it's 3D.
If I rendered much more awesome models(and textured) it would've been more obvious. Vanneto said: Works here: nvidia geforce 8600GT. Cool, that's my old card. TranslatorHack 2010, a human translation chain in a.cc. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Dario ff said: Did you try the ones I attached in the last post? Using the two new shaders you posted had the same result as the last time I tried it. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dario ff
Member #10,065
August 2008
![]() |
The shadow shader seems to be compiling correctly, it's the lighting the one with the problem. Well, I wouldn't know how to debug it without a card for sure.
struct PS_OUTPUT { float4 color : COLOR0; float depth : DEPTH; }; PS_OUTPUT ps_main(float2 normalMapTexCoord : TEXCOORD0) { PS_OUTPUT Out; float4 color;
color = tex2D(texture, normalMapTexCoord); Out.color = color;
return Out; technique lighting { pass { FragmentProgram = compile glslf ps_main(); VertexProgram = NULL; } }
So yeah, you can comment pretty much everything inside ps_main(). If you see something visible, then you can try adding more and more lines until it screws up. That would help, if you're willing to do that. EDIT: Oh, and don't comment the global variables that are above ps_main. Otherwise, the program will fail when setting them. TranslatorHack 2010, a human translation chain in a.cc. |
Neil Walker
Member #210
April 2000
![]() |
Dario ff said: float4 color : COLOR0; The colons are baffling me? There are many voids in my C/C++ knowledge but all of them I thought I knew what I didn't know. But not these. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
Dario ff
Member #10,065
August 2008
![]() |
That's CG, not C++. TranslatorHack 2010, a human translation chain in a.cc. |
Neil Walker
Member #210
April 2000
![]() |
Well, that shows I should read the whole thread instead of random bits and why I didn't follow the syntax. I guess if I read all the code and saw the lighting bit at the end I might have realised something was up. Still, glad to see there's nothing I don't know about C/C++ that I didn't already know I didn't know Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
Jones64
Member #10,718
February 2009
|
I tested it just now, it's pretty impressive Performance seems fine, but one thing I noticed is that the application uses about 236MB of video memory. Will this increase a lot if you build this into a full game? Works smooth with a GeForce 8800GT in Win7-64.
|
Dario ff
Member #10,065
August 2008
![]() |
Jones64 said: Performance seems fine, but one thing I noticed is that the application uses about 236MB of video memory.
Well, the images I included had some useless empty spaces, and were very high-res, so it's expected. I could map the height map into the normal's alpha channel to reduce it 1/3 TranslatorHack 2010, a human translation chain in a.cc. |
Mark Oates
Member #1,146
March 2001
![]() |
Vanneto said: Works here: nvidia geforce 8600GT. That's the card I have! Dario ff said: Cool, that's my old card. It's my new card. Then again, I did buy it like 2 years ago. That's "new" to me, since I'm old now. -- |
Chris Katko
Member #1,881
January 2002
![]() |
Mark Oates said: That's the card I have!
That's the same card my friend has. -----sig: |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Dario ff said: So yeah, you can comment pretty much everything inside ps_main(). If you see something visible, then you can try adding more and more lines until it screws up. That would help, if you're willing to do that. Speaking of the second object_light.cgfx : First, I went back to using Then if I comment out lines 79-234 (everything), then I get to see the assorted isometric diamond floors, the mansion, the guy in armor, and the column. I tried to take a screen shot, but it captures the desktop underneath for some reason. If I comment out line 219 If I comment out lines 113-158 (the while (i<32) { block), then I get a gray screen again, so I don't think there's anything wrong with that chunk of code. If I comment out lines 161-203 (the if (directional_strength > 0) { block, then I still get a gray screen. If I comment out lines 113-203 (both of the previous blocks of code) then I get a gray screen with all the objects in black, which makes sense since final_light is initialized to 0.0. What values of final_light would make every color turn grey(transparent?)? I don't really know how I could isolate the problem anymore. Something else that doesn't make sense is why it works for some people, but not for others. All ps_main is doing is returning a color, and that should be the same for everyone. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dario ff
Member #10,065
August 2008
![]() |
Interesting. Could you do another test? Try these and replace object_light by renaming each of these. Version _a will just pass the color and output with no depth whatsoever. So you'll likely see an isometric floor. Version _b will pass both color and depth, but no lighting whatsoever. Version _c will pass the directional light, but it won't cast any shadows. Version _d will pass the directional light and cast shadows. I've removed the parts for iluminating with dynamic lights. The full version would be the one you already have. If one of the versions doesn't work, then we've narrowed down the culprit. The reason it's grey is that it's most likely not compiling well. A final_light with a value of 0 would just turn it black. TranslatorHack 2010, a human translation chain in a.cc. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
All four versions have the same result, a white screen with dark grey cutout rectangle on the bottom of the screen. I changed all the Results : version _a - version _b - version _c - version _d - So it looks like the problem is with casting shadows somehow. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dario ff
Member #10,065
August 2008
![]() |
Great. Version _d only has this (horrible I know) chunk of code added:
1 if (tz < shadow_f) {
2 float4 new_col;
3 float al;
4 al = 1.0;
5
6 new_col = tex2D(texture_shadow_map, screen_pos+float2((2.0/screen_w), (2.0/screen_h)));
7 float shadow_t;
8 shadow_t = new_col.r*255.0 + new_col.g*255.0*255.0;
9 if (tz < shadow_t) al+=1.0;
10
11 new_col = tex2D(texture_shadow_map, screen_pos+float2((2.0/screen_w), (-2.0/screen_h)));
12 shadow_t = new_col.r*255.0 + new_col.g*255.0*255.0;
13 if (tz < shadow_t) al+=1.0;
14
15 new_col = tex2D(texture_shadow_map, screen_pos+float2((-2.0/screen_w), (2.0/screen_h)));
16 shadow_t = new_col.r*255.0 + new_col.g*255.0*255.0;
17 if (tz < shadow_t) al+=1.0;
18
19 new_col = tex2D(texture_shadow_map, screen_pos+float2((-2.0/screen_w), (-2.0/screen_h)));
20 shadow_t = new_col.r*255.0 + new_col.g*255.0*255.0;
21 if (tz < shadow_t) al+=1.0;
22
23 al /= 5.0;
24 luminance2 -= 0.12*al*directional_strength;
25 }
So I guess you can comment there and see what happens. My guess is that ATI doesn't allow to read from outside the texture, so that's why it crashes probably. If commenting those lines between al=1.0; and al /= 5.0; works, then it's that I guess. I'll try and fix those coordinates inside the texture's limits. EDIT: Try the attached shader if you want. And thanks, this will help me a lot later. TranslatorHack 2010, a human translation chain in a.cc. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Using version _d, if I comment out this line : Edit for your edit : If I comment out the same line I did with version _d, then it works like version _c again. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dario ff
Member #10,065
August 2008
![]() |
I see. Then I guess you should try either: luminance2 -= 0.12; To see which of them won't let it compile. TranslatorHack 2010, a human translation chain in a.cc. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Using all the different combinations you posted, I still get a gray screen. I just noticed on line 218 you have this : See how it sets luminance to 0.0 instead of luminance2? Well I changed it to : The only way it works is if I comment out My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dario ff
Member #10,065
August 2008
![]() |
That weird behaviour reminds me of what might happen when using way too much RAM for the current shader. I really don't have any clue how to solve that weird problem, other than trying to lower the amount of memory used. Try lowering these arrays' size: float light_x[32]; float light_y[32]; float light_z[32]; float light_r[32]; float light_g[32]; float light_b[32]; float light_range[32]; To 24, or 16. And yeah, I couldn't figure out how to pass float3's arrays instead. TranslatorHack 2010, a human translation chain in a.cc. |
|
|