How to fix overlapping floor textures in procedural room generation

Hey guys, I’ve been working on an infinite procedurally room generator that uses pre-made rooms.

Problem:
When I generate “Hallways” to connect dead ends to one another, the floor and ceiling parts overlap, causing it’s textures to glitch out.



I have tried to offset the floor and ceilings and I had to offset it by a large amount to even see a difference which makes it really noticeable and ruins the immersion.



Using Unions aren’t an option either as I’ve heard it’s really resource intensive.

I have thought of a solution in which the script fills in the gap between two rooms seamlessly but I have no idea how to do that.

If there’s any way I can solve or just avoid this issue, please let me know!

Thanks!

12 Likes

My first thought was to union them (even though unions are frowned upon) or make a mesh for the floor. But since you generating them (through a script I’m guessing) I’d recommend doing a pattern of increasing and decreasing the height of the floor ever so slightly so you can get rid of the overlapping textures. And, since the height change is so minuscule, it shouldn’t affect the smoothness of walking over the floor.

2 Likes

The problem is, the height of the floor/ceiling has to be specifically 0.05 studs apart (from my trial and error) and any lower than that will cause the same issue. 0.05 studs is really noticeable as you can see from the images I provided. The script-generated floor and ceiling are clipping inside of other room floors too, so yeah I don’t think that will work :frowning_face:

1 Like

Ok, one more idea I had was that you could use 1 big part for the floor and just generate the walls, ceilings, etc. and when the player exceeds the size of the floor, you create a new one based on the player’s position and delete the pre-existing one. Or you could teleport the player to somewhere else in the labyrinth of halls (the back rooms it seems). I hope what I just wrote made sense :sweat_smile:

1 Like

That would work really well if it wasn’t the fact that some rooms will have varying ceiling height sizes. Some rooms would have holes in the floor or staircases that goes down.
(And yes it’s the backrooms)

1 Like

You can try either adjusting room placement, adding buffer space, ensuring correct texture tiling and UV mapping, using procedural texture blending, implementing transition zones, applying post processing effects, or considering dynamic mesh generation.

2 Likes

Darn! Well I’m not sure. You could make it less noticeable (maybe) if you make a new material under material manager. You would put the greyscale carpet texture under “ColorMap” and then go to a third party software, such as photoshop (or the free version which is photopea). From there, go to Filters>3D>Normal Map and adjust the scales and height sliders from there (I use photopea so I just explained it from my use of that photo editing program, I do not know if it’s the same for photoshop). You can save the normal map texture and upload it under “NormalMap” for your Roblox material.

Assign the floor the new material you just made

If you have any questions let me know!

1 Like

I had to make the hallway floor and ceilings way bigger than it should be in order to cover any gaps so adjusting the room placements or adding buffer space wouldn’t do much since the floor and ceilings would clip into other rooms regardless.

I don’t think UV mapping can be used at all in this situation.

I am unfamiliar with procedural texture blending and dynamic mesh generation, I’ll look into them. Transition zones is a pretty good idea, ill try to work with that.

Actually, I made a mistake, you should just use the normal map texture since I believe if you use the greyscale colormap, it would have the same overlapping effect (I can’t test it right now since I’m on mobile and have no access to a computer)

1 Like

I tried this but the texture’s colour still changes at the intersection point.

The orientation of the texture should be consistent. They can’t align like this unless you make some aliasing solution where you basically tile individual tiles …

Also, have you considered just using large roofing parts? As long as you maintain a grid size, and move the parts on gridsize increments, they’ll align. You’ll still suffer z-fighting, if you overlap them though.

Simply union the parts and you don’t have that issue anymore.

Good luck boo let me know if you have any more questions/inquiries regarding that topic. Hope it works out! :slight_smile:

1 Like

Could you do it kinda like a puzzle? Idk. Like make the pieces to fit together seamlessly with no overlaps by changing the edges of the ceiling and floor to snap together like puzzle pieces! (or legos since they’re 3d.)

Like I said previously, I’m planning to make some rooms have varying heights and depths so this would simply not work.

I already went through using unions in my post, It is simply just too unoptimized for an infinitely generating room structure.

1 Like

I had to make the hallway floor and ceilings way bigger than it should be in order to cover any gaps.

The reason why is because the script-made hallways are really random and can vary in shape and size which a normal part cannot fill in completely.

1 Like

Cant you control the randomness? Like any random whole number between 20 and 125. and then those values are the only acceptable ones for height. All the new rooms on the second floor would be above 125 regardless if the first-floor generated rooms got that high or not. Then for the gaps use another parameter that is math based. find the difference in height between the first generated room and the second one and add a small wall that fills in the difference.


would that work?

I can’t control the randomness. What I mean is that the path between the 2 rooms are always different.
The walls that connect the 2 rooms are completely fine, the real problem is the floor and ceiling.

For example, sometimes the connector may generate like this:

and sometimes like this:

My solution to this was to just make a big enough floor and ceiling part that covers the gaps which lead to my issue with the textures overlapping.

Could you add a separate ceiling par for the hallways themselves in the same way you connected the rooms?