|
 |
« on: March 19, 2019, 09:12:57 AM » |
|
Decided to come out of my hole on Smashboards and make a quick guide towards dealing with emissive maps.
Now note, I'm by no means an expert on TEVs (I refuse to call them shaders, because that's not what they are) in fact, I'm really only just learning about them... Really all I'm doing here is just basic mapping which is very easy. Harder stuff like bloom, while possible, I'm not sure how to do.
Just recently I released a new version of my signature hack Dark Pikachu version 4.6 which makes use of a fake (constant color Intensity) emissive map to achieve this without a memory overflow:

basically how this fake map works exactly is you have the emissive map:
 and the color you want it to show in the material's Constant Color 2 (basically the image functions as an alpha channel for this color)
.png) note that Constant Color 2 is delegated by the TEV stage applying the emissive map (stage1 in this case) in order: stage0 | stage1 | stage2 | stage3
 note that stage1 was added and is completely custom
it takes the output from stage0, adds Constant Color 2 * TextureColor, and clamps the result stage0 just applies shading to the diffuse map (untouched from the original TEV) stages 2 and 3 are for finalization (also untouched) (not too sure how they work)
now if you want to use a REAL emissive map like this:
 all you need to do is change B and C of stage1 to multiply the TextureColor by the TextureAlpha: (rather than the Constant Color by the TextureColor like the fake one does)

I couldn't use a real emissive map at original quality because it would cause a memory overflow causing the Wii to freeze, but I WAS able to get it working by downscaling the emissive maps by 50% but here I thought the scaling would automatically apply the size difference and upscale... I ended up being wrong, and as such, the emissive map is repeated here:
 at least it works like it's supposed to 
now note the entire image is green (including the transparent parts), so it looks no different from the fake version but that's where the similarities stop as the fake version can't mix colors.
if you still need a little extra info as to how TEVs actually work, basically they just iterate over each stage in order and apply the equation noted in the Output Function.
here's a rough mock-up I did to help me understand Pikachu's TEV0:
 note that the values supplied below the stage() function are just best guess values for testing there's other stuff that could be done to it, such as comparison operations, but I never really needed that
so note that OutputColor is treated as a register with a default value of 0.0 Python doesn't inherently support vectors, let alone vector maths, so this was really all I could do without writing a complex vector class. but the operations are still the same as what I have above: (0,1,2) + (3,4,5) = (3,5,7) (0,1,2) * 2 = (0,2,4)
for even more detailed information, you can follow BlackJax96's old notes here: https://forums.kc-mm.com/index.php?topic=39649.msg801235#msg801235
hopefully this helps shed some detail on a topic that's not so well covered 
EDIT: Update! HOOOOO BOY this one took some real effort to get working:
 

so for the main texture, in order to optimize it AND make it look good, I had to separate the RGB and A channels how I did that was a CMPR image for the RGB, and an IA4 image for the alpha:
RGB + A =  and then of course overlay the RGB5A3 emissive texture to achieve the glow
the reason I used CMPR+IA4 instead of RGB5A3 is because of the bit difference on alpha RGB4A3 only has 8 shades of alpha IA4 has 16 shades of alpha and of course CMPR only has 2 shades of alpha (GIF quality alpha)
so with CMPR I actually get ~RGB565 quality with a smaller data print add 16 shades of alpha to that and the reduced quality is almost unnoticable
as a result of this, I had to write a separate TEV to merge the channels AND overlay the emission:
 TEV0 is the original emissive TEV from the full RGBA8 version TEV3 is the new version that references the alpha map in stage0, and applies it to the RGB map in stage1 before adding the emissive map in stage2 with the finalizations in stages 3 and 4
the material layout also adds the alpha map as a texture slot:
 so yeah stage0 references TexMap2, stage1 -> TexMap0, stage2 -> TexMap1 (I wanted to keep compatibility so I wouldn't have to touch the emissive stage)
so yeah, REAL emissive map fully working in Brawl here's the hack btw if anyone wants to play with it: https://mega.nz/#!M0ASkSAa!Vj5T4I3A92uG5XGFTj3yoQ3TKEw3L7rX7eP7JLyQwQo as well as the full quality version: https://mega.nz/#!l4ZnzAQA!cHOYoJ2f-dUDa9fEkeiqY-k2jlL8f4ON7YXp-Zb1yPM and the fake version: https://mega.nz/#!Y9gjzKab!rVwEL5KIXDFUrUEwEIZCx9rLZotL81A67Ce_sMtHmJs hopefully these serve as some good examples to help you guys get a feel for TEVs 
|
|
« Last Edit: August 26, 2020, 12:27:46 PM by DarkPikachu »
|
Logged
|
|
|
|
|
|
|