ray-cast/ray-mmd

No handling of texture morphs?

nathanvasil opened this issue · 7 comments

It doesn't look like Raycast is handling texture morphs? I think it would be relatively simple to implement this. I just implemented it quickly and it looks like it's working (although it might be desirable to implement it everywhere that you read ObjectMaterialTexture.)

In materials/material_common_2.0.fxsub, on line 761, insert

float4 TexColor = float4(1,1,1,1);
TexColor.rgb = lerp(1, TexColor * TextureMulValue + TextureAddValue, TextureMulValue.a + TextureAddValue.a).rgb;
albedoColor.rgb *= TexColor.rgb;

Could probably clean that up, I just created TexColor so I could copy/paste :)

Just downloaded Raycast today (looks amazing, thanks!), so I apologize if this is supported, but just in a different fashion than I expected.

Edit: oops forgot the declarations, although I'm sure you know that:

float4 TextureAddValue : ADDINGTEXTURE;
float4 TextureMulValue : MULTIPLYINGTEXTURE;
float4 SphereAddValue : ADDINGSPHERETEXTURE;
float4 SphereMulValue : MULTIPLYINGSPHERETEXTURE;

Just shoved up anywhere at the top of the .fxsub.

Don't know that there's a lot of call for using sphere map, but if you support reading sphere map textures from models, seems you might as well support texture morphs for that slot as well.

Edit2: That's on the current master, not dev, but doesn't look like dev supports this either. Line numbers might be different is all.

I've actually started doing a lot of work on this. I'm not familiar with Github or etiquette on pull requests (I think that's the right phrase?) but I'd be happy to share what I've done. I'm not sure how to share it so that it would be most useful to you (assuming you're interested.) I'm just an amateur, and it's messy, I'm not nearly as good at making everything clean as you are.

So far, I've added texture + sphere morph support, full addUV support (including sphere viewN.xy, toon NdotSun, addUV .zw coords, although of course the toon mapping is a little dumb considering deferred rendering), autoluminous morph name support, and loop 1 normal map masking (mostly for seams, especially on normal map mode 3.) I have plans for doing more.

the creator seems to be inactive both here and on twitter

Okay, thanks @MarieRose1301 , I guess I'll just work independently then.

@nathanvasil would be cool to see your edits in action someday :)

@MarieRose1301 Altered material_common at https://www.deviantart.com/vasilnatalie/art/Download-Raycast-Expanded-Mat-Features-757065229?ga_submit_new=10%3A1532988342 , with support for what I've mentioned above and probably a little bit more.

Okay, more edits at https://www.deviantart.com/vasilnatalie/art/Download-RayPMX-for-MMD-758662294 . This adapts the raycast controller to use bone controls for improved functionality and simplified animation (no more + and - registrations). Also a few other changes, see the readme if you want. Could also simplify the code, but instead, I coded it to preserve backwards compatibility with morph controls.

Involved separating out some common light, skybox values to _common.fxsub files, which is probably a good idea even if nobody likes my edit. You gain a smidgen of load time by loading common params regardless of whether a particular light or skybox needs them-- probably microseconds-- but you reduce the risk of errors due to duplicated code.

Okay, more edits at https://www.deviantart.com/vasilnatalie/art/Download-RayPMX-for-MMD-758662294 . This adapts the raycast controller to use bone controls for improved functionality and simplified animation (no more + and - registrations). Also a few other changes, see the readme if you want. Could also simplify the code, but instead, I coded it to preserve backwards compatibility with morph controls.

Involved separating out some common light, skybox values to _common.fxsub files, which is probably a good idea even if nobody likes my edit. You gain a smidgen of load time by loading common params regardless of whether a particular light or skybox needs them-- probably microseconds-- but you reduce the risk of errors due to duplicated code.

hey, that's pretty nice, thanks for sharing!