3
\$\begingroup\$

We use multiple box meshes to create our game world in Unreal Engine 4, but we also use those boxes with translucent/sss materials with refraction. The problem is there are seams between those boxes but want to combine those meshes to make them behave like one big mesh while rendering. We don't want to leave our boxed layout.

refractive mesh boundaries

Those boxes use all exactly the same material by the way.

Thank you for your help.

\$\endgroup\$
1
  • \$\begingroup\$ Are you making a voxel/boxel game? If so, I'd recommend taking a look at this to solve your problem. \$\endgroup\$ Commented May 2, 2017 at 12:09

1 Answer 1

2
\$\begingroup\$

You don't say if your boxmodel uses separate materials per face - if not, I suggest that you do this. Then pre-pass each face before drawing the block, checking for a water block against each face; if a water block exists, use a nodraw material on that face.

This is essentially what Minecraft does every time it needs to redraw a block, it constructs the block from separated faces then determines face visibility based on various criteria.

Edit: to do this, some prep work is needed. Your box model should be unwrapped with a Multi-Sub Material (assuming 3DSMax here, search for the term in your 3D modeling app of choice) and with a different material id on each face - giving six material ids. Now you have the ability to put a different material on each face. Next, import into Unreal and create the six materials (or basically two materials - one water, one nodraw). Apply these materials to the box faces in the StaticMesh Editor. Then, at runtime and when you do your box visibility calculations, you can examine each face and determine what material it should display: I imagine something like "if face is >orthogonal to camera direction, or if next block in this face's normal direction is the same as this block, then use nodraw; otherwise use water".

This should give you what you need, at least at a basic level - enough for you to begin modifying, anyway. I cannot give node setups because I don't know your current implementation so I've tried to be as descriptive as possible.

\$\endgroup\$
2
  • \$\begingroup\$ Sounds like a great idea. As I'm a beginner with ue4 could you please provide some node setup (if possible)? Then I will mark the thread as solved and upvote your answer. \$\endgroup\$
    – sirjofri
    Commented May 15, 2017 at 12:02
  • \$\begingroup\$ Original answer edited to contain a set of example steps. \$\endgroup\$
    – JonS
    Commented May 15, 2017 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .