Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

3dSen VR - 3D NES Emulator For Virtual Reality

Breathing new life into classic NES games by magically converting it into 3D and letting you play in VR · By geod

Trouble with textures Sticky

A topic by Cherkov created Mar 14, 2018 Views: 679 Replies: 8
Viewing posts 1 to 9

I ran into this problem while working on Urban Champion. There was a piece of a foreground building that the program recognized as part of the city skyline. I was able to get it separated using the delete button, but that messed up the city skyline on other screens. When I tried to restore those pieces back to how I wanted, the original piece I wanted as the foreground building became part of the city skyline again.

Here is a picture of the offending piece.


And here is how it look in the texture editor.


With a little searching, I eventually found the part of the texture used to draw that part of the shape., but when it was changed, it ended up changing more than I wanted.


The other problem I had was trying to add a window texture to the buildings display windows. Originally, I was going to use the clone tool and add another piece as the glass, but when I tried using the texture tool, the results were not ideal. Here is a picture of the window and its texture.


And here is how it looks when filled in.


Now I still could have made this work by cloning another piece and scaling it down and offsetting it, but wasn't prepared to spend that much time.

(9 edits)

Let me explain stuffs:

- Issue 1:  in the context of one pattern/shape, a 2D tile always maps to a 3D tile, so when you modify the solid 2D tile which is used in many positions,  3D tiles mapped to that 2D will all changed

Return to the main problem: because the background city pattern contains a solid 2D tile so the background shape incorrectly contains that building part which is also a solid tile. That's that reason. Solution, play with pattern restriction (default is 99 tiles in x and 99 tile in y).With background city pattern you should set restriction x to 1, the background city will be cut into shapes with width of 1 tile. 

After that you should create a pattern composing of the solid tile and the lower brick tiles (in tile mode).  Or merge brick shape with the shape of solid tiles.

Shape will be segmented correctly after that because the underlying mechanism in segmentation is: shape will expand as big as possible as long as there is at least one pattern compatible with it (compatible mean pattern 2dtile set is the super set of shape 2dtile set)

- Issue 2: the reason is  that game uses "transparent color - value 0" for the windows. The empty part corresponds to empty 2d tiles - "solid" tiles with all transparent color pixel. That special kind of tile is currently filtered  out before the segmentation process. That's why we see the emptiness here - the default semantic of this kind of tile in most cases.

Because of the lack of color in nes system in some case like this case, the game uses transparent color as an additional one, that behavior cause issue. I will try to see how to handle this issue.

Setting the restriction to 1 fixed the building immediately. That's one function I haven't played around with much. I though the numbers represented pixels, so it's good to know it's really tiles. I must have missed that part in the manual.

Thanks for explaining how the backend stuff works.  It really helps when editing. I've read through the manual and managed the basics with some trial and error. I would love to say I completely understand, but I'm not there yet. I wish I had a better grasp on the more advanced tools, like Merge, Delete, and Create in tile mode.

(2 edits)

Tile mode only has Create action: creating a new pattern with selected tiles. It doesn't have Merge Delete and Create :)

The magic of deformation tool - Correct setup for window pattern. I also rotate (90 degree in x axis) and scale the sidewalk pattern to give us more depth and to wrap the texture into correct side.

(1 edit)

I was just saying how I wish I knew how to use the tools better. I know Merge and Delete are Shape mode, and Create is Tile mode :P

The Deform tool is something I am trying to get to grips with. I'd like to know how you got those windows in. It looks like you took the building shape and cloned it and then deformed it, but I'm sure there's more to it than that.

There is one problem from a gameplay point of view. There is a guy that occasionally pops out of the windows to throw flower pots at the fighters, and a lady that throws confetti at the winner. It would be cool to get the window to "open" when they appear. That seems like it would require scripting to read memory and deform the window accordingly.

(1 edit)

That's just that like you said: took the building, cloned it then filled solid color then deformed. Only one new thing was: setting Restriction X = 4 so we have a series of windows, not a single big one.

 I will try to explain the deform formula

We know that the windows shape is empty in center so we want to "pull" all the vertex toward the center to fill the emptiness. Pull via x axis or y axis is enough. Here we choose the x axis. The generic formula to pull x value of vertex  to  center is:

deltaX = -A * sin(B * x ) ( x is normalized from -0.5 to 0.5)

sin(x) is symmetric crossing 0 and the amplitude -A is negative so if x > 0 then deltaX < 0 and if x < 0 then deltaX > 0 . It means in all cases vertex are pulled toward the center. Then I was going to  try several combination of A and B to obtain the desired result - completely filled the emptiness.

It turned out A = 0.3 and B = 4 work. It's just that, nothing magic here, just the basic of sin/cosine function.

And yes if you want to customize one shape properties based on another shape properties, you must use script but we don't need to access game state in this case, just shape properties are enough.


That is a great explanation of the Deform formula. I have some questions about x, y and z though. Delta is the change in direction. So I figure Size is the size of the shape in x, y, or z direction? Or is it the size of the sine wave? Pivot seem like the origin point of the sin wave maybe, so 0.5 would be the middle of the shape in whatever direction. I can't figure out what the x, y, z is in the parts like sin( _ * x + _). Is it the movement of the sine wave in that direction on the particular plane? 

Sorry for all of the questions. I never got far in math. I'm trying to brush up on my sohcahtoa.

It's correct. x, y, z are normalized value of coordination X, Y, Z. That means that given that PivotX = 0.5, for vertex at the right border 

- X will be SizeX / 2 => x = X / SizeX = 0. 5 => x, y, z will run from -0.5 to 0.5

If we set pivot to 0, 0, 0 => x, y, z will run from 0 to 1.