prerogative

Author Topic: New video on 4way blends  (Read 1775 times)

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
New video on 4way blends
« on: December 29, 2016, 06:50:00 PM »
« Last Edit: December 30, 2016, 01:25:57 PM by wallworm »

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
Re: New video on 4way blends
« Reply #1 on: March 13, 2017, 03:01:59 PM »
Today I updated the docs for using 4way blends.

lauris47

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
  • laurynaslubys.com
    • View Profile
Re: New video on 4way blends
« Reply #2 on: July 23, 2018, 07:05:49 AM »
(This question was updated multiple times)

I see that displacement map textures are working inside 3Ds Max.
How can I maintain such textures when I export to FBX? Is it possible at all?

Would it be possible to bake shader/material to a single texture, so that can be reassigned to a regular material that is supported in export of FBX?
« Last Edit: July 23, 2018, 08:03:35 AM by lauris47 »

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
Re: New video on 4way blends
« Reply #3 on: July 23, 2018, 11:10:20 AM »
This is likely a tricky issue. First, Wall Worm uses DirectX Shaders for blend and 4way. I do not know if there is a one-to-one translation.

I have written a function to convert the blends to OSL shaders in a Standard material. This requires using Max 2019+. I have not exposed these functions to the UI yet. Also, I do not know if Maya will use OSL shaders.

So the short answer is that it is theoretically possible but not tested.

lauris47

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
  • laurynaslubys.com
    • View Profile
Re: New video on 4way blends
« Reply #4 on: July 24, 2018, 04:41:08 AM »
Ok, Thank you for an explanation. With current project I tried multiple versions of Maya and Max. I'll try 2019 Max to see how it works over-there.

However, I was thinking that baking the shader to a texture and later use it as a single texture would be a waist of resources. Considering that each surface actually uses same textures but blends them while baked textures would require to combine these few textures to huge maps for each surface (building, ground etc.) to maintain individuality. I think newest Doom game used 16k textures, so it is possible.

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
Re: New video on 4way blends
« Reply #5 on: July 24, 2018, 10:06:18 AM »
The only sane way is to use native shaders. In Max there is a DX shader (viewport) and an OSL shader (render) for this. Baking entire scenes would create too many large bitmaps if you wanted to keep any resolution.

lauris47

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
  • laurynaslubys.com
    • View Profile
Re: New video on 4way blends
« Reply #6 on: July 24, 2018, 11:08:26 AM »
Hmm, but these shaders are not supported trough FBX export. I used Send to Maya from Max, which I believe uses FBX as well, and all textures disappeared. Only ones that remains are from the regular geometry/materials. I need to find a solution where at least the base texture is transferred. Maybe you have suggestion for that?

I attached pictures of both Maya and Max 2018. I think the blending on 2018 Max is shown correctly? I see different textures appearing on same faces.

Thanks

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
Re: New video on 4way blends
« Reply #7 on: July 24, 2018, 11:14:27 AM »
Yeah, this is an issue of FBX not supporting all Materials. And if it did, it would also depend on Maya supporting the materials/shaders. Those that are going through are Standard materials.

I will see about exposing the function to convert the DX shaders to Standard using OSL. Once I expose it, this will require using Max 2019. Again, the DX-to-OSL isn't yet exposed. I'll let you know when it is.

Once I add it and you have latest Wall Worm installed, you can Wall Worm > Wall Worm Importers > Batch Level Importer and choose FBX as the generated file to make it. Stay tuned.

[EDITED]
« Last Edit: July 24, 2018, 11:21:00 AM by wallworm »

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
Re: New video on 4way blends
« Reply #8 on: July 24, 2018, 04:24:28 PM »
I have updated WW with exposure to the ConvertBlendToOSL methods. However, it won't do you any good. The OSLMap is not preserved in FBX. I'm also not sure that all the map channels are exported (4way blends use channel 10 and they seem to be missing.

Not being a Maya user I think this is the end of the road for my advice on this topic. At this point, why not just keep it all in Max?

lauris47

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
  • laurynaslubys.com
    • View Profile
Re: New video on 4way blends
« Reply #9 on: July 25, 2018, 03:17:32 AM »
Thank you very much.
For me it is most important to export it to FBX, because FBX is supported across all mainstream game engines and 3d programs. I will load final maps in Unity not in Hammer.

Out of curiosity, does 4way blend remains when exporting map back as a Game Level from 3ds Max WW?

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
Re: New video on 4way blends
« Reply #10 on: July 25, 2018, 09:54:28 AM »
I see. Still, exporting to FBX to send to Maya to then send to FBX again for Unity seems like an extra hassle.

In any event, the FBX tests I did yesterday showed that the 4way blend channel was lost (UV Channel 10) when saving scene to FBX. So I need to amend my comment above.

WW Uses Channel 1 for almost all things. But there are a few exceptions.

  • Vertex Alpha (-2) For 2Way Blends on displacements
  • Map Channel 10 for 4way Blends on displacements
  • Map Channel 1 for everything else

I will report this directly to Autodesk.

lauris47

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
  • laurynaslubys.com
    • View Profile
Re: New video on 4way blends
« Reply #11 on: July 26, 2018, 03:24:17 AM »
Ok thanks. For now I will have to use one texture instead of 4way blend style.
When I have some spare time I'll try to learn 3ds Max basics to bake 4Way blend materials to textures and see how result looks.
(I am Maya user, Max is so different and difficult for me)

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
Re: New video on 4way blends
« Reply #12 on: July 26, 2018, 10:07:57 AM »
Just a heads up. After more testing, I have discovered that the FBX does preserve the 4way blend channel. Unfortunately, it moves it from channel 10 to channel 2 (at least for a return trip to Max). So you can still render the blends in other DCC provided you have a shader for that in the DCC that will use the data as needed.

The DX shader used in Max is preserved in the FBX and comes back to Max fine.

The remaining question would be if Maya can use Max's FX files. If so, it may just be an issue of the path to the bitmaps not working in the FBX for how Maya expects them.

Finally, in terms of baking an entire level. Doing this would be catastrophic for almost any target application as mentioned in an earlier thread. The only sane solution is to replicate the 4way shader in the target DCC or game engine.

lauris47

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
  • laurynaslubys.com
    • View Profile
Re: New video on 4way blends
« Reply #13 on: July 27, 2018, 08:15:02 AM »
Maya maintains the same dx11 shader reference, directly from Max, but it doesn't work. I tried loading same named shader from Maya, but it doens't work as well. I am not good with this.

Perhaps possible solution would be to manually add textures to a custom shader for example built in Unity on each model. On export these specific objects could use default material of Maya, just like I did now with a simple blin.

Then, material's shader inside Unity could be replaced with custom shader, or perhaps unity has something similar already, I need to do some digging.

If I understood correctly, how textures are blend together is kept in a separate texture, e.g. called "plaster_a_blend.tga", then according to strength of colour in that map, specific textures are exposed on the face of the mesh?
I did some shader coding inside Unity and I used such technique.

(I noticed that Unreal engine has 4Way blend technique as well https://docs.unrealengine.com/en-US/engine/ui/leveleditor/modes/meshpaintmode/vertexcolor/materialsetup/4way, maybe that one can be directly connected when model is exported from max to Unreal)
I will discard baking the textures as a possible solution.


wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3497
  • Karma: 98
  • Behind me?
    • View Profile
Re: New video on 4way blends
« Reply #14 on: July 27, 2018, 08:48:45 AM »
If Maya is maintaining the DX shader, is it showing any texture at all? If so, it may be a result of the FBX bug mentioned above--that UV channel 10 is moved to UV channel 2. The 4way blend shader blends between the 4 textures based on the vertex colors (which are contained in channel 10).

So to explain the blending:

2way blends use Vertex alpha and an optional tiling blendmodulate texture to work with vertex alpha.

4way blends use map channel 10 (and no texture) for blending.