Views: 20,054,805 |
Home
| Forums
| Uploader
| Wiki
| Object databases
| IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search |
04-26-24 03:31 AM |
Guest: |
0 users reading Notes On: SMG 2 Water | 1 bot |
Main - Archived forums - SMG documentations and tutorials - Notes On: SMG 2 Water | Hide post layouts | New reply |
Slacker |
| ||||||||||||||||||||||||||||||||||||||||||||||||
Normal user Level: 13 Posts: 17/29 EXP: 9763 Next: 504 Since: 08-13-13 Last post: 3463 days ago Last view: 1181 days ago |
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:
WarningPlease 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.
All of that aside...water. From what I've read, there are two ways to use "water" in your custom galaxies:
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 WaterAreaJust 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.
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. Understanding Rectangular WaterAreasTo 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 PointsJust 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.
Moving Water CubesIt'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.
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. 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. 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 AboutThere 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:
DownloadsRealized 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. |
SunakazeKun |
| ||
Boss Bass Normal user Level: 75 Posts: 299/1551 EXP: 3666366 Next: 160538 Since: 06-15-14 From: Germany Last post: 2287 days ago Last view: 2259 days ago |
This is a very helpfully tutorial! Thanks for creating this. Youtube | Github | Neo Mario Galaxy | Super Mario Galaxy & Super Mario 3D Land Modding |
Splitwirez |
| ||
Otherwise known as rob55rod. Should probably get back to SMG2 at some point... Level: 68 Posts: 208/1207 EXP: 2616540 Next: 112260 Since: 08-28-13 From: ._______________. Last post: 1963 days ago Last view: 1573 days ago |
This makes me want to make an underwater fire galaxy...if that makes any sense. I are going to do that now. 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. |
NWPlayer123 |
| ||
Member Imma Snuggle You Level: 110 Posts: 3303/3604 EXP: 14205154 Next: 203732 Since: 07-07-12 From: Colorado Last post: 3102 days ago Last view: 1260 days ago |
Posted by Splitwirez AKA Aquaflame? <: ____________________ "I hate playing musical chats" ~ Quote of the month |
Splitwirez |
| ||
Otherwise known as rob55rod. Should probably get back to SMG2 at some point... Level: 68 Posts: 209/1207 EXP: 2616540 Next: 112260 Since: 08-28-13 From: ._______________. Last post: 1963 days ago Last view: 1573 days ago |
Posted by NWPlayer123 Copmpletely forgot about that. Would it be a problem for the 1 World project if Aquaflame (or something like it) made its way into NMG? |
SunakazeKun |
| ||
Boss Bass Normal user Level: 75 Posts: 300/1551 EXP: 3666366 Next: 160538 Since: 06-15-14 From: Germany Last post: 2287 days ago Last view: 2259 days ago |
Euhh...If some planets exist, yeah. Youtube | Github | Neo Mario Galaxy | Super Mario Galaxy & Super Mario 3D Land Modding |
NWPlayer123 |
| ||
Member Imma Snuggle You Level: 110 Posts: 3304/3604 EXP: 14205154 Next: 203732 Since: 07-07-12 From: Colorado Last post: 3102 days ago Last view: 1260 days ago |
Posted by Splitwirez Not really, you might want to revise it a lot though xD ____________________ "I hate playing musical chats" ~ Quote of the month |
Splitwirez |
| ||
Otherwise known as rob55rod. Should probably get back to SMG2 at some point... Level: 68 Posts: 210/1207 EXP: 2616540 Next: 112260 Since: 08-28-13 From: ._______________. Last post: 1963 days ago Last view: 1573 days ago |
Posted by NWPlayer123 Okay, good. Awkward coincidence, but whatever. |
Slacker |
| ||
Normal user Level: 13 Posts: 18/29 EXP: 9763 Next: 504 Since: 08-13-13 Last post: 3463 days ago Last view: 1181 days ago |
Posted by SunakazeKun You're very welcome. Posted by Splitwirez 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. |
Splitwirez |
| ||
Otherwise known as rob55rod. Should probably get back to SMG2 at some point... Level: 68 Posts: 215/1207 EXP: 2616540 Next: 112260 Since: 08-28-13 From: ._______________. Last post: 1963 days ago Last view: 1573 days ago |
Posted by Slacker 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} |
smg2haxer |
| ||
Newcomer Normal user Level: 7 Posts: 7/7 EXP: 1106 Next: 342 Since: 07-21-14 From: Australia Last post: 3519 days ago Last view: 2542 days ago |
Oh wow!! Thanks so much! I really needed to work out how to add water! ____________________ Oh my does time fly? It's nearly been a year since I registered! |
shibboleet |
| ||
Fire Mario DROP TABLE users; Level: 123 Posts: 2970/4661 EXP: 20892294 Next: 338972 Since: 07-07-12 Last post: 1349 days ago Last view: 362 days ago |
If you PM me the details, I can easily just modify it since I know what controls it. ____________________ a |
Slacker |
|
Slacker |
| ||
Normal user Level: 13 Posts: 20/29 EXP: 9763 Next: 504 Since: 08-13-13 Last post: 3463 days ago Last view: 1181 days ago |
Posted by Splitwirez Don't worry about it. Glad to help. Criticism is welcome. Posted by smg2haxer You're welcome! Posted by Luigi 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:
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. |
shibboleet |
| ||
Fire Mario DROP TABLE users; Level: 123 Posts: 3735/4661 EXP: 20892294 Next: 338972 Since: 07-07-12 Last post: 1349 days ago Last view: 362 days ago |
Thread got crapo'ed during the board switch, but this thread is really good so I went through the time to fix it. ____________________ a |
Anthe |
| ||
Member I have found a basket to put in my SD card reader so I never lose it Level: 66 Posts: 814/1099 EXP: 2380536 Next: 81315 Since: 08-17-12 From: Belgium Last post: 768 days ago Last view: 358 days ago |
This is wonderful material. Can't believe I never saw this. Thank you so much for making this. ____________________ |
MK7tester |
| ||
Magikoopa I'm back Level: 104 Posts: 2978/3145 EXP: 11579501 Next: 282625 Since: 07-07-12 From: Dolphic Island Last post: 2599 days ago Last view: 2597 days ago |
This tutorial is amazing, thank you so much, will be much easier to mess with water in SMG2 now. |
Main - Archived forums - SMG documentations and tutorials - Notes On: SMG 2 Water | Hide post layouts | New reply |
Page rendered in 0.080 seconds. (2048KB of memory used) MySQL - queries: 30, rows: 230/230, time: 0.010 seconds. Acmlmboard 2.064 (2018-07-20) © 2005-2008 Acmlm, Xkeeper, blackhole89 et al. |