Views: 9,494,036 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
04-20-19 10:13 PM

Main - Posts by Slacker

Pages: 1 2
Posted on 08-13-13 04:16 PM, in Shadows on Custom Models in SMG 1/2 Link | #30172
Hello. So I was looking at the Stormshine model that Cosmological had put up some time ago and noticed that the in-game version of the model was rendered as flat color and textures. Needless to say the planet lacks some degree of depth when shadows are absent. (Still a nice model though :)).

Now I am under the impression that shadow-like effects can be handled via textures. Fair enough. However, I am still confused about how this stuff would be done. Looking at some of the texture dumps for some SMG models, I noticed that textures for larger objects (planets), "shadows" don't seem to be included.

An example of what I'm talking about:
The flat texture for the planets "siding":


The planet rendered. (Image taken from Whitehole):


Notice the aforementioned "depth." The channel near the center of the image where the player should use wall kicks is shaded so that you can see the walls edges. Also, at the side of the planet where the player can fall off and die (near bottom of image), there is a nice gradation of shade.

So is galaxy doing something in-game, independent of texture work (shaders?) or is this just some fancy texture work?

I would love if someone could expound upon the subject. I know next to nothing about this stuff.


Posted on 08-13-13 05:12 PM, in Can I help? Link | #30185
Say, do you think you could upload the complete, non-split model in .OBJ form?

Can't tell whats going on in the level with all of the individual .OBJ files.

Posted on 08-13-13 05:15 PM, in Shadows on Custom Models in SMG 1/2 Link | #30186
Oh so vertex colors. Thanks for the help.

I am judging from Arcanine's post, working with vertex colors is a no go at this point?

Posted on 08-13-13 06:39 PM, in Shadows on Custom Models in SMG 1/2 Link | #30194
Yikes. Now that's a problem.

So let me get this straight, since vertex colors are not supported at this point in time...textures would actually have to be used to create shadows?
I'm not sure how you would even do something like that.

[quote A PolyCount-Wiki]Vertex color AO works well for meshes that use tiled textures, like environment models, because the tiling prevents unique lighting from being added to the textures. In this case texture-based AO would require a separate non-tiled texture using a second set of UVs, which would increase the texture memory and also increase the vertex count for the model (to store the 2nd set of UVs).

This addresses my main concern. Light/Shadows can be baked into smaller textures used for smaller objects (ie. a Bullet Bill Blaster), but the same process doesn't work well with the tiling textures of environmental models.

Just speculating here, would this process pretty much be:

1. Set up UV coords

2. Apply seamless texture.

3. Create semi-transparent texture which would act as shadow.

4. Set up another set of UV coordinates which would be warped to hold shadows appropriately. I'd imagine UVs might have to be overlapped? :O

5. Apply "shadow" texture on top of "diffuse" texture thus blending them together.

Correct me if my guess is wrong, (I hope it is). This sounds nightmarish. Also, I was under the impression that blending textures on the fly is somewhat slow/expensive along with what the quote says about texture memory usage.

Moreover, can the game even handle multiple UVW coordinate systems on models?

Has anybody successfully done this on complex model work? Like, are there any custom planet renderings I can look at to see how it's properly done?

Again thanks for the help.

Posted on 08-13-13 10:02 PM, in Can I help? Link | #30199
Sense of scale? I don't know what the creator of this model knows.

I mean I can do a little work on something like this to help things along.

How big is Mario compared to these, ChamferBoxes?
[spoiler Mario's Size?][image]

Also, how big is the texture compared to Mario?
[spoiler Texture Scale?][image]

Furthermore, the topology on some of the models is strange. There are some extra edges in the model that imply that you want to make that type of Mario-Grassy-Top look. I put in some placeholder textures to mock it up, but then again I don't know what is going on with the model.
[spoiler Placeholder Textures][image]

I'd imagine that you'd want to stay away from making grass like this since it can make faces that aren't quads or triangles. Then again it might be a problem on my end.
[spoiler Geometry with Texture Work][image]

Posted on 08-15-13 01:40 PM, in [Stormshine Galaxy] Stormshine Star 1 [a cosmo design] [Complete!] (rev. 2 of 08-15-13 01:43 PM) Link | #30356
Hey Cosmo, have you updated this planet's 3D model recently, or are the Stormshine models provided on Kuribo64 the most up to date?

I would like to briefly take a look at them.

Posted on 08-26-13 06:13 AM, in Shadows on Custom Models in SMG 1/2 (rev. 2 of 08-26-13 02:16 PM) Link | #30853
Ah, again thanks for the information all.

[quote SuperMario64DS]OBJ models cannot handle more than one UV Channel.

Oops. I wasn't even aware of this. I haven't even looked into OBJ capabilities since they're so limiting.

Yeah, that sounds pretty awful. Also, very limiting. I understand how a technique like this might be acceptable for simple models, ie. rectilinear planes and cylindrical type objects, but when things become more complex, is this method even feasible?

So I took a shot at this cheating-shadows-with-textures method with a cube. I fiddled around with my software's viewport and got it to display models in the same shade-less manner much how I've seen Whitehole and SMG render custom models. One texture is used.
[spoiler Cube: No Shadows][image]
Moving on, I darkened the texture a bit to mimic a geometric face that would be in shade. This gives some depth, but it's still pretty lame. Two textures had to be used of course: one for "lit" faces another for "shaded" one.
[spoiler Cube: Basic Shade][image]
Lastly, I tried to get a softer gradation of shade on the cube model. I used my image software and simply added a gradient-like effect. I needed one for the "lit" texture and one for the "shaded" one. So now in total I need four textures: fully lit (top), fully shaded (bottom), soft shaded lit, soft shaded bottom.
[spoiler Cube: Soft-ish Shaded][image]
[quote SuperMario64DS]Now here's why this is bad: File size.
Goes without saying, SuperMario64DS's point is pretty well illustrated with this. Also, since I'm taking an approach used for large environment models (that is, without packing UV's with rendered shadows), tiling the texture is a common tool. Note in the last image with 4 textures, the brick size is larger. This is because I couldn't tile the textures without completely messing up my custom painted shadow textures. If I try, the result is:
[spoiler Cube: Tiled Custom Shadows][image] Yuck, but then again, I'm probably pretty bad at this since I've never had to render shadows like this. It would be nice to see what Glem's input would be (since he's the guy that does this stuff?), but apparently he is unavailable.

--Other Model--
So since I was bored, I threw together a quick model. I wanted to see how this might work on a more complex model. Spoiler: I didn't even try texture shading after getting everything set up. Haha. I guess I'm too lazy for this stuff. Anyway, here are two renderings of the model. NOT viewport screenshots, renderings:
[spoiler Processor-Frying Rendering 1][image] [spoiler Wii-Demolishing Rendering 2][image]
Now a shot of it as if it were imported on the Wii:
[spoiler Flat Color No Shadows][image]
So my UV coordinate setup isn't perfect since I just was doing this quick for a test (as the model images so subtly imply :)). I have a fairly visible seam on the model, which made me ponder how this texture shadow stuff might work when meeting UV seams. Idk, I just couldn't be bothered.
[spoiler The Seam][image]
I did look at shading through vertex colors though. Hah, so much faster. After I adjusted my UV's, I ran a quick operation and got a nice shading effect on my model. The result is below. I left the textures off for now. This is another shot from the viewport, still in "flat-color, no-shadow" mode.
[spoiler Shading baked into Verts][image]

So yeah, what an adventure.
Posted by blank
Unfortunately 3DS files doesn't support vertex colors either. For some reason there is no simple 3D model format that supports vertex colors (except for PLY files, but they only support one mesh per file). So to support vertex colors you would have to use a file format such as COLLADA, which would be a lot of work.

Hmm. I've worked with COLLADA briefly. Had some minor troubles with model smoothing but that could have been my fault with export settings. Very sad to hear that about vertex colors though. Are you guys aware of anyone using COLLADA for other game hacks?

Anyway, sorry for the rambling, I just thought I would be useful for others to see this stuff documented. Thanks again.

Posted on 08-26-13 02:20 PM, in Shadows on Custom Models in SMG 1/2 Link | #30872
Posted by FnarGod
I make custom shadow by bakin textures. But IMO the hardest part about texturing is seamless textures perfectly mapped

Oh? What resolutions are your textures? Do you think you could post the texture images as an example?

Posted on 08-26-13 02:58 PM, in Shadows on Custom Models in SMG 1/2 Link | #30876
Posted by FnarGod
i use textures from the game, then i take, 'shadeless' off, and then I just bake the textures, after I map them of course.

Sorry, but I really don't understand your process. You make it sound so simple. XD

I use dumped textures like you as shown in a previous post; if I was to ever move forward with any of this stuff, I probably would make my own textures.
[quote Slacker][spoiler Cube: Soft-ish Shaded][image]

However, I had to modify the images to get certain effects. When you say "bake," doesn't that mean that you are using your 3D software to automatically generate images that use calculated shadows? Those are images I'm interested in seeing.

Posted by FnarGod
What do you use to make this btw. blender? maya? 3DMax?

I actually use 3DMax. What do you use? There seem to be a lot of Blender users on this board. :)

Posted on 08-27-13 12:08 AM, in Shadows on Custom Models in SMG 1/2 (rev. 2 of 08-27-13 12:16 AM) Link | #30916
Posted by Marionumber1
Not trying to force you into coding a COLLADA importer, but this might help:


It's a Python module for reading COLLADA modules as Python objects.

Way ahead of you. Took a peek at that module before. Very interesting. I'm hoping to sit down with the documentation provided and work on something useful. Frankly, though, I'm not well versed in all this hacking stuff. I know some Python coming from C# and basic Java, but I would have to really buckle down and up my proficiency to move forward.

Thanks for the suggestion though MN1!

As a side note, [user 149] requested the model I had made before (not the cube). I have uploaded it on Kuribo64's uploader in case anyone wishes to look at it and give suggestions for shading, etc.

Posted on 06-16-14 06:26 PM, in New to Level Creation? Click here! [Complete] [Guide] [To Everything] Link | #42703
Sorry for the bump. Just wanted some clarification on getting models to show up in Whitehole 1.1.
The whole process of getting up to speed with these things is painful to say the least.

I suppose my problem would be with packing my files. Just to give you an idea of what I'm doing:

  • I exported my model from my 3D package as a standard .OBJ. (I am not using blank's extended .OBJ for now).
  • Used OBJ2BDL to generate a .BDL file. (v0.4)
  • Used KCLCreate to (v0.7 .exe) to generate .kcl and .pa
  • Placed {.bdl, .kcl, .pa}(model files) all in their own folder.
  • Found PlanetMapDataTable.arc in extracted SMG2's ObjectData folder
  • Used the BCSV editor to add an entry
  • Stripped all "Unknown" fields of the string "Placeholder" in appropriate fields.
  • Ensured all flags had values of 0 (ie. LowFlag, etc)
  • Placed .BCSV in its own folder (separate from model files)
  • Dragged model files folder to RARC and then dragged resulting file onto yaz0 .exe file
  • Dragged .BCSV containing folder to RARC and then dragged resulting file onto yaz0 .exe file
  • Got resulting .arcs; named them after model file name and PlanetMapDataTable
  • Replaced old PlanetMapDataTable.arc with my new PlanetMapDataTable.arc in ObjectData
  • Added .arc into ObjectData folder
  • Launched up Whitehole 1.1 and went to RedBlueExGalaxy (FlipSwap) to check things out.

In the end, I couldn't find my new "planet" in Whitehole. Hopefully I just missed something simple.
The model is a simple cube with one checker texture on it. Texture is a 128x128 .png. Cube is low res with 8 verts, triangulated. Running Windows 7.

I would appreciate if someone could point me in the right direction.

Posted on 06-16-14 07:45 PM, in New to Level Creation? Click here! [Complete] [Guide] [To Everything] (rev. 3 of 06-16-14 10:18 PM) Link | #42715
Posted by NWPlayer123
Not when nobody is willing/able to do it. Mega's given up on Whitehole, he's never going to work on it again.

That's a shame. People don't seem to appreciate and understand the amount of work that goes into a program like that.

Posted by NWPlayer123
Even if you don't use vertex shaders, you HAVE to import with v0.3 or it won't show up in whitehole, even if you rename an object to the model name.
EDIT: Here https://dl.dropboxusercontent.com/u/56043942/Programs/SMGHackingTools/BDLCreate-0.3.zip

Thanks for that. Went through the same process will a .bdl from OBJ2BDL v0.3 -- still doesn't work.

How do you see if your model makes it into Whitehole btw. Maybe I am just doing it wrong.
After I place my files in ObjectData I run Whitehole, select RedBlueExGalaxy and go to "Add Object."
That's pretty much where I am looking for my files.

Is this right way to go about it?

Posted on 06-16-14 10:09 PM, in New to Level Creation? Click here! [Complete] [Guide] [To Everything] Link | #42723
Thank you very much. I knew it had to be something simple. :)
So strange that renaming must be used to see the model. A view from Whitehole:
[spoiler Whitehole 1.1 View][image]
Though I had to scale the model up by around 80 or so; the models came in awfully small. I suppose I'll have to model larger in my 3D package.

However, when I try things out in game, I the models don't show up.
[spoiler In-Game View][image]
Is there anything that I might be missing here? Maybe the scale has something to do with it.

Before I go any further, should I be asking these questions in a specific thread? I don't wanna derp up this thread too much if I'm being off topic or something..

Posted on 06-16-14 10:12 PM, in New to Level Creation? Click here! [Complete] [Guide] [To Everything] (rev. 3 of 06-16-14 10:24 PM) Link | #42726
Posted by Slacker
  • I exported my model from my 3D package as a standard .OBJ. (I am not using blank's extended .OBJ for now).
  • Used OBJ2BDL to generate a .BDL file. (v0.4)
  • Used KCLCreate to (v0.7 .exe) to generate .kcl and .pa
  • Placed {.bdl, .kcl, .pa}(model files) all in their own folder.
  • Found PlanetMapDataTable.arc in extracted SMG2's ObjectData folder
  • Used the BCSV editor to add an entry
  • Stripped all "Unknown" fields of the string "Placeholder" in appropriate fields.
  • Ensured all flags had values of 0 (ie. LowFlag, etc)
  • Placed .BCSV in its own folder (separate from model files)
  • Dragged model files folder to RARC and then dragged resulting file onto yaz0 .exe file
  • Dragged .BCSV containing folder to RARC and then dragged resulting file onto yaz0 .exe file
  • Got resulting .arcs; named them after model file name and PlanetMapDataTable
  • Replaced old PlanetMapDataTable.arc with my new PlanetMapDataTable.arc in ObjectData
  • Added .arc into ObjectData folder
  • Launched up Whitehole 1.1 and went to RedBlueExGalaxy (FlipSwap) to check things out.

Yup added it to PlanetMapDataTable's bcsv, repacked, and then replaced old arc with my new one.

Posted on 06-16-14 11:40 PM, in New to Level Creation? Click here! [Complete] [Guide] [To Everything] Link | #42728
Posted by Luigi
Let me see your XML structure.

I ran this test on Dolphin. (Wow, now that I think about, I really should have mentioned that). Dolphin is so much easier for testing since its right on my 3D modelling desktop.
All from this thread: Running SMG on Dolphin without an ISO

So yeah, I am testing by replacing StageData folders with folders I modify with Whitehole.

So far its been working with really, really basic edits. The types that involve adding a couple Goombas or moving around coins and red/blue switch panels. Perhaps this is the problem.

Running on Dolphin 4.0.2 x64.

Posted on 06-17-14 11:39 AM, in New to Level Creation? Click here! [Complete] [Guide] [To Everything] (rev. 3 of 06-17-14 02:51 PM) Link | #42743
I got it to work.
[spoiler In-Game Basic Model Import][image]
I used ProjectMapObjDataTable with field set to "SimpleMapObj" just as you suggested.

Embarrassingly enough, the problem might have been simpler. Since I am working on two computers for this, the problem might have been caused by not transferring everything over correctly. Strange that the game didn't just straight up crash.

Anyway, thanks for the help. :)

EDIT: My carelessness was in fact the problem. I used the PlanetMapDataTable method just now and things worked just fine:
[spoiler In-Game with PlanetTable][image]

Posted on 09-05-14 04:05 PM, in Notes On: SMG 2 Water (rev. 5 of 06-09-15 11:25 PM by shibboleet) Link | #47828
Hello. So I have been doing a bit of work figuring out things for building my own worlds in SMG 2. So far I've made some progress learning some of the inner workings of the game and how to apply them to levels and what not. It's been a painful, slow process but things have been starting to come together (at least for my own purposes). These things take time -- so much so that I have been starting to forget how to do things I have previously known how to accomplish. Really this thread is a bunch of notes to myself to ensure that I don't forget stuff. I have tried to organize processes and explanations to be easy to follow -- I really don't want to spend large amounts of time relearning what I already knew. By putting these notes here, I hope to make learning SMG 2 hacking for others less painful. It is really for my own use so it's pretty ramble-tastic to provide myself with a comprehensive archive of things. I am by no means an expert with this stuff. Therefore, if any of the bigger brains here find problems/errors with my methods, please tell me so that I can fix things up and not pass on bad information.

To start, here is a list of programs used to work with this stuff:
Program Description of Use
Whitehole v1.1.2 In my experience, the most stable form of Whitehole. Used for most edits.

Whitehole v1.2 While version 1.1.2 is stable as far as I know, it doesn't show Areas/CameraAreas. This version handles that stuff but isn't as stable.

Anarchy in the Galaxy Does a better job at adding in objects, but is very unfriendly and not realistic for level editing on its own. Used for adding in Areas.

Dolphin v4.0.2 Emulator. Used for quick testing/edits.

Yaz0Enc Used to encode rarc in Yaz0 compression.

Yaz0Dec Used to decompress Yaz0 file to rarc. Needed in tandem with yaz0enc to make Anarchy modified .arcs work with Whitehole.

Most of this stuff can be found in NWPlayer123's Galaxy Hacking Tools Megalist. Yaz0dec is found in SZSTools.


Please note, I do not test with a Wii. I simply use Dolphin. At the time of this writing, I am using Dolphin 4.0.2 -- the version available on the group's homepage. I am aware that Dolphin emulation is more "forgiving" than the Wii. I still use Dolphin simply because it is far quicker for testing (at least with my setup) and provides for easier, better quality screen captures.


For all of those who have skimmed through this thread and are unwilling to read my notes...I'm hurt. But fair enough. Time is short and my notes are long. So here is are some useful key points -- I am not here to waste time for newcomers.
  • At the time of this writing, you must use Anarchy in the Galaxy to add WaterAreas.
  • Anarchy saves out .Arcs that are incompatible (for the most part) with Whitehole. You must decode and then re-encode Anarchy modified arcs to work with them in Whitehole.
  • A WaterArea using a box shape is based off of a 1000 unit box.
  • WaterAreas have a bottom pivot when using a box shape.
  • To match up a WaterArea to a RailMoveWaterObj, area must be a cube of xyz scale 0.7 and the area must be placed at the bottom center of the RailMoveWaterObj.
  • RailMoveWaterObj is a 700 unit cube.
  • There are other shape modes, all of which are based off 1000 units, be it side length, height, or radius.

All of that aside...water. From what I've read, there are two ways to use "water" in your custom galaxies:
  • By using "Planetary" water
  • By using the Area type object WaterArea

I am only concerned with the latter -- WaterAreas. Apparently, "planetary" water is built straight into some of SMG's models or something. Nothing I am familiar with.

WaterAreas are somewhat tricky, but make sense. All in all, these objects are based off of a base measurement of 1,000 units. For now I will only cover rectangular WaterAreas. These are cubes that have 1,000 units in length, width, and height. Basic geometry.

Just to be clear, WaterAreas are objects that handle collision only -- they are invisible. When the player enters a WaterArea, they are able to swim. These are general objects used all over the game to make swimmable levels. These are NOT to be confused with RailMoveWaterObj which Whitehole conveniently renames "Cubed Water Block." This object is a visible model of a cube with beveled/chamfered edges with a spiffy water shader on it. RailMoveWaterObj is simply a model with no collision and is therefore useless in its own right save for decoration. For reference, RailMoveWaterObjs are used in Cosmic Cove Galaxy (named StarCreekGalaxy in the filesystem). More on this later.

Confused? WaterAreas are invisible collision and RailMoveWaterObjs are visible models. Much like the relationship between a .BDL and its respective .KCL & .PA pair. The below screenshot is of just a WaterArea:
WaterAreas are invisible, but you can swim in them.

Adding a WaterArea

Just to remind myself, the following is how you make a WaterArea. Areas themselves are not handled all that well in Whitehole. Just to note, I use Whitehole v1.2 to view areas in Whitehole's awesome 3D view. Whitehole cannot add Areas so here you need to use Anarchy in the Galaxy.


Once you open Anarchy, head to the areas marked in red. Changing the rightmost dropdown should make the middle dropdown AreaObjInfo. Add in a new blank object with the "Add" button marked in green.

Now you should have a new object.

Change parameters. Make sure no scale value is 0 as marked in green. Be sure to change AreaShapeNo marked in red to something other that FFFF (-1 in Whitehole).

  1. First open Anarchy and then hit "Open"

  2. You will need to navigate to the StageData part of your filesystem.

  3. Here I work with RedBlueExGalaxy since I've read that it is the most stable galaxy to hack. Really you can open any galaxy's folder and open the "GalaxyName"Map.arc file. As an example, here I am opening the file RedBlueExGalaxyMap.arc.

  4. You should see a listing of data. Open the rightmost dropdown and head to "Placement." By doing this you should be to the section we are interested in, "AreaObjInfo."

  5. Hit "Add" to make a new blank object.

  6. Rename it WaterArea and change the parameters as shown. There are two important things to note here. Firstly, make sure you change scale to 1 (or some positive decimal) for x, y, z. If you leave it as 0, you are making an infinitesimally small object, that is it will not do anything and it will not show up in Whitehole's 3D view. Secondly, do not forget to change AreaShapeNo to 0 for a cube. A value of FFFF will crash the game. Note: I don't know what l_id's do. Again I'm really just a novice with this stuff. But in Anarchy I try to keep them from being the same as other objects. It's called and id for identification -- I try to make it unique.

  7. Save your map file out. Take care with this as well. I have found that if you just hit save right out of Anarchy without hitting enter in the current field you're changing, the change won't stick. So be careful.

  8. Now Anarchy and Whitehole don't really play nicely with each other. Anarchy's form of saving differs from what Whithole can read. Anarchy saved files will work fine in game though, again just not with Whitehole. To fix this, you need to re-encode any arc file you save with Anarchy in the Galaxy to get the same data into Whitehole.
  9. [image]
    Drag .Arc map file onto yaz0dec. A new file should pop up in your .Arc directory.
    Drag resulting file onto yaz0enc. Yet another file pops up.
    Delete the older (crossed out) files and keep the newest, ugliest file. Rename the kept file to RedBlueExGalaxyMap.arc. This is your map file.
  10. First drag the Anarchy modified .ARC file to yaz0dec.exe. This should give you an ugly .arc 0.rarc...thing.
  11. Next drag the resulting file onto yaz0enc.exe. This should seem to yield some sort of awful .arc 0.rarc.yaz0 monstrosity. Really, it's just your new, cleaned .ARC file. Rename it to "GalaxyName".arc after you've deleted the other two files including your original Anarchy modified .ARC file.

  12. And that's it! (A terrible workflow I know, but it works). Open up your galaxy in Whitehole (v1.2 displays Areas to you should probably use that one). Your new WaterArea should be viewable. For this example, a 100 x 100 x 100 pink cube should be at (0,0,0) -- the world origin. In game, as I've said before, this will be an area where you can swim measuring 1000 units for length width and height.

Understanding Rectangular WaterAreas

To give a concrete look at things, I made a 3D model meant for measuring aspects of the game. The model is simply a large platform measuring 5,000 units in length and width. It is 1000 units tall. It's pivot is not at the model's center, but at a corner. This is to ensure that if my platform object's parameters are at (0,0,0) the platform will have its corners at positive XZ distances from the origin. Pivots are important, and I'll talk a little about them later.
Good for measuring models. Getting measurements allows you to make your custom models fit with official objects.

The model is textured as a grid. Each cell is exactly 10 units in length and width. They are numbered in groups of four and colored to make counting easy. It's a useful model for understanding the game and making official objects match up with my custom stuff.
Grid is sectioned into 400 unit chunks.

By using the model, it's obvious that a WaterArea is a 1000 unit cube (when all scale values are 1). In the below image, my WaterArea placed at the measuring platform's center. Therefore it must have influence over all of the center green tiles including one more row of blue tiles. That is in the XZ plane. I've read about wonky Y-Scale when matching WaterAreas with RailMoveWaterObjs, ie. the height of the are cube is strange. Not so much. All that is happening is that WaterArea has its pivot point at the bottom-center of its cube while many other objects, namely RailMoveWaterObj, have their pivots at their xyz center. RailMoveWaterObjs are 700 unit cubes.
The red outline marks the end of swimmable area.

To make things even more concrete, here is an example. RailMoveWaterObj. A good place to look is in Cosmic Cove's (StarCreekGalaxy) map. Switching the scenario to [2] the third entry down the list displayed in Whitehole, you can see the area where RailMoveWaterObjs are officially in the game. Note that below each of the objects there are WaterAreas. Looking at each WaterArea scale, everything is scaled by 0.7. From this it's easy to see that RailMoveWaterObjs are in fact 700 unit cubes (with chamfered edges). 0.7 of 1000 = 700.
In order to see this part of the map, change Scenario to what is shown in second image.

But what if we wanted an even bigger cube? Remember, RailMoveWaterObjs are not 1000 unit cubes. They are 700 unit ones. Below shows this:
Scale needs to increase.

Well that takes a little math. Say, we wanted to match our RailMoveWaterObj to a WaterArea of a normal xyz scale of 1 -- that is, a 1000 unit cube. You must make a 700 unit cube scale up to 1000 units. This is your classic Algebra 1 percentage problem. 700x = 1000, solve for x. This turns into 1000/700 which yields 1.4285714285714285714285714285714. Great. Punch that into RailMoveWaterObj's scaling parameters. Whitehole will round things a bit and there you go -- a 1000 unit RailMoveWaterObj that has functioning water collision.
RailMoveWaterObj scaled up to match a normal scale WaterArea. Note the "Z-fighting" occurring at the bottom of the WaterCube. This just shows that the faces of the bottom of the RailMoveWaterObj match the ground a little too perfectly. Generally, you want to move the cube up a little more to prevent this since it's ugly.
RailMoveWaterObj is placed at a Y position of 500. This makes sense. We scaled to the size of a normal cubed WaterArea -- 1000 units in length, width, & height. Since RailMoveWaterObjs have a pivot at the center of the cube. The model must be moved "up" half its height -- in this case 500 units.

Pivot Points

Just to drive home the point on pivots points here are some images. Pivots are very noticeable when rotating objects. To illustrate, the picture below shows a rotating pixelated Mario image. :)

Point from which 3D transformations take place is at the center of the image. This is similar to a RailMoveWaterObj pivot point.

Point from which 3D transformations take place is at the bottom of the image. This is similar to a WaterArea pivot point.

That's really all there is to that.

Moving Water Cubes

It's called RailMoveWaterObj for a reason. It is possible to get these cubes of water to move along paths at designated speeds with water collision. The below diagram sort of outlines the key points:

RailMoveWaterObj must be in MapParts.

There are three ingredients to this concoction: a WaterArea/RailMoveWaterObj pair (as described prior) and a path. To start, add a RailMoveWaterObj to Map Parts. This is important. A General object RailMoveWaterObj will not work for movement. Most of the time, you put things in Map Parts when they need to be moving.
Hit "Add Object" marked in green. Hit "Map Part" marked in red and then find your object (in this case RailMoveWaterObj).
The result should be the rightmost image - Cubed Water Block in the Map parts folder.

Each path has a Path ID field. Each object has a Path Id field as well. To match an object to a path, you must match the object's Path ID to the desired Path's Path ID. Pretty simple.

To view available paths in Whitehole, hit the "Show all Paths" button at the top of the 3D viewing window. You'll know that things are linked when you select your path-linked object and see its matching path pop up even if you don't have "Show all Paths" enabled. Very convenient.
Object ID must be unique. PathId must match the path you want to use.

When placing all of the elements together, have the WaterArea placed at the bottom of the RailMoveWaterObj (due to pivots as discussed earlier). Place the pair of objects at the beginning point of your path. Also make sure that your RailMoveWaterObj has an ObjectID. Make sure this id is unique.

Now your RailMoveWaterObj has a path. But it will not move as things are. Paths have point parameters that designate how things move along them. I have not tested these extensively, but I am assuming that since speed is designated on a point-to-point basis, things can move faster and slower depending on how far along path-linked objects are on the path.
I closed my path. Based on official Cosmic Cove values, this is probably unneeded given that all path points have speed.
The field for changing speed is the red marked "point_arg0."
Marked in purple is the field for delaying movement at a path point. I left it as -1 so signify that I don't want delay. You can change this though.

These parameters can be changed in Whitehole. I would suggest v1.1.2 for this since it's more stable and can reliably changes Path parameters. Be sure that you are in Point Arguments and not Path arguments. There's a difference.
  • point_arg0 = Movement Speed
  • point_arg5 = Delay

If you want to change things in Anarchy take a look at the below image:
We are working in hexadecimal with the two fields marked in red. So value "A" is 10 and value "14" is 20.
Hexadecimal is a base 16 counting system. On Windows 7, just use the built in Windows calculator tool and set it to "Programmer" mode to convert.
You must change point parameters, found by going to middle drop down marked in green.
To find the points for the path you want, find the Common.PathPointInfo._ section with the same number as your path's Id.
(Found by Splitwirez in MapParts and Path Variable Testing).

As a side note, I closed my path for this example. The path only had 2 points on it. Only one point (the first point) had a speed parameter. Had I not closed the path, the Water Cube would just move and then get stuck at the end of the path. Closing the cube.

Official use doesn't seem to require that the paths are closed. In Cosmic Cove, all points have a speed values and the path is open. Either way works, the official way is probably better.

Now you have a RailMoveWaterObj that can move. Great. But remember, RailMoveWaterObjs are only models without collision so we need the WaterArea to move with with the water cube. To do this, match the value in your WaterArea's MapParts_Id field to the ObjectID of your RailMoveWaterObj. That is all that is needed -- WaterArea does not need a PathID value.
MapParts_ID must match ObjectID of RailMoveWaterObj.

That is all there is to that. Scale things seem to work, granted match positions correctly. Pretty cool.
Moving Water Cube with swimming collision.

Just as a warning, this type of behaviour doesn't move the players along with the water cube. Consequently, fast cubes can be difficult to swim with. Perhaps this is why the water cubes were only in one galaxy. That aside, it's still a really neat level element, and with some creativity, you can probably do some cool stuff.

Some Things to Think About

There are some things to think about here. Scaling an object like this up is usually not a good idea. Because RailMoveWaterObj has chamfered/beveled edges, it is not an absolute cube. As you scale something like this up, its edges won't match the edges of a cube object. Things will look bad if you scale too much -- as with most objects in game. This was just an example to show how controlled things can be.

Things can get pretty wonky once you try to work with rotations on WaterAreas since areas are invisible. Whitehole does not render area things correctly, so don't trust what you see. I would suggest making a custom model with an adjusted pivot so mimic what the area's look like in Whitehole. I have shown what I use in my own setup. If you match my model's x,y,z position, scale, and rotation, it give an accurate representation of what you are dealing with when working with WaterAreas that are cubes. Here you can see how the beveled edges of RailMoveWaterObj don't make it fill up the WaterArea perfectly.
A custom model to allow me to see cubed areas correctly in Whitehole. When making custom models, the pivot point will be wherever world (0,0,0) is in your 3D modelling package.

At the point of this writing, custom textures cannot be transparent or translucent. Bad for making water. Also, there is no way to make animated textures. Again, bad for making water, specifically the pretty shimmering water that makes SMG 2 look great at times. That shimmering water, if I understand correctly results from shaders/materials -- a category of 3D that can be complex in and of itself. Be that as it may, we cannot take pre-made, official shaders from existing models and "band-aid" them on our custom ones. Unfortunate.

In the end, scaling up water cubes can provide a bit of a kludge for water in galaxies. Overlapping a scaled up RailMoveWaterObj WaterArea pair on a custom model to hide the bad edges can mimic a lake or a pond (provided you vertex color parts submerged on your custom model some sort of blue or green to strengthen the "underwater" effect).

Things are imperfect. But workable, and with good planning, I'd imagine you can make pretty believable levels.

As a side note, what I've been talking about WaterAreas with a AreaShapeNo field set to 0. This value specifies a box area. There are other types. Courtesy of Splitzwirez from this thread with some of my added info:


AreaShapeNo Values

Base Measurements (Scale XYZ is 1)

Pivot Location

Rectangular Prism 0 A cube with a 1000 unit length, width and height. Bottom Center
Hemisphere (?) 1 A hemisphere with a radius of 1000 units. Bottom Center
Sphere 2 A sphere with a radius of 1000 units. XYZ Center
Cylinder 3 A cylindar width a radius of 1000 units. I don't know the height. Unknown
Strange Splashing 4 Something I've observed. Cannot swim in this area. When walking around, you may see an occasional splash. Doesn't seem useful.Unknown


Realized that I should probably include some of my custom models to help people out. They're nothing special so don't expect much. I have prefixed my models with underscores so that it is easy to my modified files in the ObjectData folder. As requested:

Large Measuring Platform
The platform I have been showing throughout these notes. Shown here. 5000 unit length and width. 1000 units tall. Useful for eyeballing measurements from in-game. Really, its just a grid you can walk on. Named _T_BigMeasurePlatform for access in Whitehole.

Rectangular Area Outliner
A custom model used to see boundaries of rectangular Area objects. Named _T_CubeOutliner for access. You must match the position and rotation of this object to those of the rectangular Area you are using in order for things to match up.

Hope this helps. If there are any ways I can improve this thread, please don't hesitate to inform me.

Posted on 09-06-14 01:06 AM, in Notes On: SMG 2 Water Link | #47858
Posted by SunakazeKun
This is a very helpfully tutorial! Thanks for creating this.

You're very welcome.

Posted by Splitwirez
A few improvements I'd like to see: The thing about Cheep-Cheeps made no sense, and if you could release those test planets, that would be great.

Removed the Cheep-Cheep part. It was just saying that surface swimming Cheep-Cheeps swim on the surface of your water regardless of where you place them and their paths.

Uploaded my models. Hope they are useful.

Really the outliner stuff should just be built into Whitehole. I had modified the AreaCubeRenderer class as a test to get Area rendering somewhat accurate, but I haven't looked too far into the inner workings of the Whitehole source to really make anything meaningful.

(post deleted) #47896

Posted on 09-08-14 03:57 PM, in Notes On: SMG 2 Water (rev. 2 of 09-09-14 12:53 PM) Link | #47941
Posted by Splitwirez
Huh. [russianaccent]Those models will make my life 400,000x easier...for 12 seconds.[/russianaccent] Oh, and I just noticed that while editing my post, I accidentally removed the 'thank you' part. I'm so sorry if that sounded picky or rude or anything, it was meant to be sort of a 'thank you for the awesome tutorial, here are some ways you could make it even better' but then it came out as a 'HERE'S A FLAW, HERE'S ANOTHER FLAW, FIX THEM' type thing. I'M SO SORRY, IT WAS MEANT TO BE CONSTRUCTIVE CRITICISM...{wanders off, rather upset}

Don't worry about it. Glad to help. Criticism is welcome. :)

Posted by smg2haxer
Oh wow!! Thanks so much! I really needed to work out how to add water! :D

You're welcome!

Posted by Luigi
If you PM me the details, I can easily just modify it since I know what controls it.

I assume this post was targeted at my AreaCubeRenderer comment. I don't really have code that you can work with since it's patchwork and bad. I was mostly experimenting with draw orders to draw each cube face separately instead of drawing all sides as one strip with two capping faces.

If I had to guess, to fix the problem would entail:
  • AreaCubes must be a 1000x1000x1000 cube rather than a 100x100x100 cube. So don't draw Areas like ColorCubes.
  • ColorCubes are drawn from center. A float is used to designate a distance from the cube's center. If a ColorCube is placed at (0,0,0), 50 units of the cube would be below the origin (bottom face at y-pos -50) and 50 units would be above. The bottom face of an AreaCube should be right at a y-position of 0.
  • When Y scale is increased, height only grows positively, i.e. the bottom doesn't grow at all in Y direction.

I can tell perhaps how to go about things. Not all that useful, sorry.

Updated: Now first post has details on how to bind a WaterArea to a moving RailMoveWaterObg.
Pages: 1 2

Main - Posts by Slacker

Page rendered in 0.027 seconds. (2048KB of memory used)
MySQL - queries: 22, rows: 140/140, time: 0.013 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.