Normal Mapping Wii demo

Discussion in 'Console Technology' started by DRS, Jun 25, 2009.

  1. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
    Just playing around a little with Devkitpro and libogc. I took gx lesson7 as a base and added normal mapping to that.
    To run it, get bannerbomb, unzip it to a sdcard, download this, rename it to boot.dol and put it in the root of your sdcard. Then follow the instructions on bannerbomb to actually run it.

    Dolphin runs it too, though, the colours seem to be more bright. Besides that it is about 5-6 times slower (I mistakenly wrote 15 last time) and the mote emulation doesnt work on my laptop.

    What you'll see is 3 cubes, lit by a lightsource on the right. The ambient lighting is done by using the normal map with a lightsource at the cam's position (which is also used for reflection). In this form, it simply adds reflection and diffuse calculations. It takes a stage to determine if the light is on the front of the surface (that's when you'll see the effect fade out) and two indirect stages to add diffuse and reflection light colour. I haven't implemented distance attenuation yet.

    The last stage, also indirect, adds the ambient map. Just using a static material texture for that would be faster I guess but for now I haven't. Picked the normal map somewhere from the internet... Lost the url but that guy demo'd how to make normal maps in some 3d tool anyway.

    The fastest setup would be just diffuse and abandon the fade out (which you could get away with in certain circumstances anyway).

    Still have to sort some suff out, I get a wrong texture format in the indirect unit so I had to convert R and G channels to B and G. Furthermore, I have to sort out/experiment a little with changing the lightmaps scale and bias. Currently I use separate maps for diffuse and specular but it isn't ideal.

    I changed the button functions a little: A button toggles reflection/specular, minus toggles vsync (hold it a bit longer) and the direction pad allows to rotate the light around the cam (hold it as classic controller). Don't mind B and plus buttons.

    Have fun!
     
  2. DeadlyNinja

    Veteran

    Joined:
    Jan 3, 2007
    Messages:
    1,221
    Likes Received:
    4
    Umm... stupid question, how do I download it? It's a dol file, and when I click on it, it shows a lot of weird text, if I right click "save as" it's either an all file or a text file. I haven't tried it yet since I've never used Dolphin before. I'll post again later to see if the all files file loads on dolphin.
     
  3. TapamN

    Newcomer

    Joined:
    Jan 10, 2008
    Messages:
    58
    Likes Received:
    42
    I'm guessing your using Windows. Right click, choose "Save Link As..." or equivalent. When the Save As box comes up, put quotation marks around the filename, so it looks like

    "nmcube.dol"

    instead of

    nmcube.dol

    then use something on your Wii to boot it up.
     
  4. DeadlyNinja

    Veteran

    Joined:
    Jan 3, 2007
    Messages:
    1,221
    Likes Received:
    4
    Ok, I downloaded it, but I don't know how to use it with Dolphin. I don't have a Wii yet, and this is my first time using Dolphin. Basically, I tried to start the .dol file like I'd load a rom on other emulators, but I just get a message saying can get 1GB of continuous memory, then the emulator crashed. I'm using the newest version of Dolphin.
     
  5. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
    Hey Deadly, how big is that dol file on your file system? Also, make sure you have the latest DX. Don't know how much mem you need; I have 3Gigs and that works for me.

    You should open the file using the "open file" box. It will recognize executable files.

    BTW, if you know anyone with a Wii, I could zip the SD card contents so you would just need to unzip that to a sd card, put it in a wii and execute the dol via the wii's system menu.
     
  6. DeadlyNinja

    Veteran

    Joined:
    Jan 3, 2007
    Messages:
    1,221
    Likes Received:
    4
    The continuous memory error is nothing according to the forums. The dol is 447KB and I have the latest DX.
     
  7. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
    You mean this thread? They are talking about loading ISOs there. I haven't looked into generating those yet. But according to that thread you should be fine if you have more than a GIG of free memory. What SVN Release of Dolphin did you get?

    Did anyone else do get it running? Forgot to mention that the fading doesn't work on the emu, have to do it differently there.
     
  8. DeadlyNinja

    Veteran

    Joined:
    Jan 3, 2007
    Messages:
    1,221
    Likes Received:
    4
    Yeah, I have 2 Gigs of RAM. I'm using 3420, the latest version in the front page. Every time I load the emulator crashes. How about a youtube video of it instead, then?

    Also, I just tested out the emulator with something else, and it worked fine.
     
  9. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
    Perhaps your browser downloaded it in ascii mode or so. I'll post a zipped version tonight so you can try that one. If that fails, I can provide you with dolphin build 3286 (though I tested with the latest version as well) and if even that fails I'll try to shoot a vid from my Wii.
     
  10. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
  11. DeadlyNinja

    Veteran

    Joined:
    Jan 3, 2007
    Messages:
    1,221
    Likes Received:
    4
    Sorry man, still the same results. Emulator crashes every time.
     
  12. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
    That's a pita. Perhaps you can play around a little with the graphics settings, turn off the shader stuff, JIT compiling etc. Dolphin generates shader code depending on the GX commands it receives so perhaps the your dol just doesn't use indirect texturing or coordinate generation the way my demo does.

    But I took some screenshots in Dolphin. In the future I might make a vid of a demo showing more than just this, currently I don't have means to capture a composite vid stream.

    [​IMG]



    [​IMG]
     
  13. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
    Mod: We only need a couple of demo images if they are all very similar ;) Thanks.
     
  14. DeadlyNinja

    Veteran

    Joined:
    Jan 3, 2007
    Messages:
    1,221
    Likes Received:
    4
    That's very impressive. It's sad that most big name developers can't pull off what hackers do with homebrew.
     
  15. Lucid_Dreamer

    Veteran

    Joined:
    Mar 28, 2008
    Messages:
    1,210
    Likes Received:
    3
    Isn't the real problem pulling this off in a functioning game?
     
  16. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
    @Deadly, I don't understand it either. It's only a matter of setting up some vertex and pixel shaders, providing binormals in the vertex data and setting up some static lights. The GPU does the rest.

    @Dreamer, the way I look at it, creating a functioning game is a real problem, not the shader.

    reg,

    Danny
     
  17. Silent_Buddha

    Legend

    Joined:
    Mar 13, 2007
    Messages:
    17,081
    Likes Received:
    6,416
    How fast would that be with a few hundred+ normal mapped textures in a game?

    What you've done certainly looks pretty good though. I suppose if the Wii is too slow to handle something like that in a normal game, the graphics could always be scaled back and an appropriate type of game targetted for it.

    Regards,
    SB
     
  18. DRS

    DRS
    Newcomer

    Joined:
    May 22, 2009
    Messages:
    135
    Likes Received:
    0
    Haven't measured yet, but it takes 2400 frames to rotate a cube and with vsync turned off it takes 5-6 seconds for a complete rotation.

    So, we're looking at at least 400 frames a sec. I think the cubes fill about half the screen, so full screen we would be looking at 200 frames a sec. Since SD resolution is only 1/3 Mpix this means the fillrate is reduced to about 67Mpix/sec. Now, the gamecube has about 640Mpix fillrate using a single tev stage. I suppose that includes a texture read as well. So mapping that to the 67Mpix, it means it takes about 10 gpu cycles to render the pixel. This number includes screen blanking, vertex operations and CPU overhead.

    To add a little about the hardware: it is able to perform a texture lookup, which results are 'blended' with a specified second texture coordinate using the indirect unit (3x2 dot product and scaling), then lookup a texture using those 'blended' coordinates and then pass that to the recirculating shader unit. From a logic point of view this would most likely take 3GPU cycles. But since the Wii has 960Mpix fill and 960Mpix texel rate (see above) I figure that the GPU might perform a texture lookup and shader operation in the same cycle (which means an indirect stage would take only 2 cycles to perform).

    So based on those assumptions and figures, it takes 2 or 3 cycles to perform diffuse mapping and an additional 1 or 2 cycles to blend in a material texture. The demo also uses reflection and fade-out, so it takes either 7 or 10 cycles to perform.

    Besides that, don't forget that a game such as Quake ran well on a 50Mpix Voodoo board, and also ran well in full software rendering on a pentium 90 and also had dynamic lighting. The Wii is FAR more capable than that. And Quake looks quite nice using normal mapping, there is a PC version going around=)
     
    #18 DRS, Jul 7, 2009
    Last edited by a moderator: Jul 7, 2009
  19. DeadlyNinja

    Veteran

    Joined:
    Jan 3, 2007
    Messages:
    1,221
    Likes Received:
    4
    DRS, I want to ask you if you know how detailed can you make a character with normal mapping on the Wii? We know the system's capable of it, but I don't know if there's a limit to how detailed you can make something look.
     
  20. rpg.314

    Veteran

    Joined:
    Jul 21, 2008
    Messages:
    4,298
    Likes Received:
    0
    Location:
    /
    BTW. does Wii support shaders? If yes, to which shader model do the hardware capailities correspond?
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...