Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Instructor
Original Poster
#1 Old 29th Jun 2016 at 5:46 PM
Sunshadow in Blender
I generated a sunshadow mesh in Blender using cmomoney's Blender Tools. The mesh seems to be scaled and positioned correctly, but in-game, the sunshadow is not "anchored" to the bottom of the object, when the object is rotated. It's projected correctly on the ground plane, but seems to rotate around a fixed point that is not the center of the bottom of the object. After some research, it appears that this is a problem with PosOffset of the sunshadow mesh being wrong. It's said that TSRW generates this correctly, but TSRW crashes on my setup so I'm not able to use it on a regular basis. In desperation, I borrowed a computer on which TSRW is able to run, but it crashes when I attempt to generate the sunshadow mesh. (I'm aware that the newer version of TSRW doesn't play well with TS3 files and am using an older version.)

Is there a way to generate a sunshadow with the correct offsets in Blender? Or even to calculate them manually?
Advertisement
Virtual gardener
staff: administrator
#2 Old 29th Jun 2016 at 6:42 PM
Weeell, thing is with this plugin is that the plugin keeps doing weird thing each Blender version. I usually use 2.65a when it comes to baking textures with the program, but then this other version of Blender keeps the bones. So I would go with Milkshape when it comes to adding sunshadows. For meshing, Blender is all fine.

Also, if you need a working TSRW version, you can get it from my blog, here: http://greenplumbboblover.tumblr.co...005426/tsrw-172
Instructor
Original Poster
#3 Old 29th Jun 2016 at 9:47 PM
Quote: Originally posted by Greenplumbbob
So I would go with Milkshape when it comes to adding sunshadows.


Milkshape has a plugin for sunshadows that gives the correct offset? Or are you referring to this tutorial? The tutorial does not explain how to find the correct offset, only how to make the shadow mesh (it does state that the offset needs to be adjusted, without explaining how). But Blender already makes the shadow mesh (i.e. the mesh itself, not the offset) correctly, so that's not the problem.
Virtual gardener
staff: administrator
#4 Old 29th Jun 2016 at 10:11 PM
Sorry! I got confused with the actual shadow map. >.< Really different things XD

Anyway, TSRW would have made things easier though for you. But in this case you could clone an object with the same height as your project, check out it's MLOD sunshadow mesh and see how far it's offset is. At least that's what's suggested to be done here: http://modthesims.info/showthread.p...308#post3078308
Instructor
Original Poster
#5 Old 30th Jun 2016 at 7:36 PM
Quote: Originally posted by Greenplumbbob
But in this case you could clone an object with the same height as your project, check out it's MLOD sunshadow mesh and see how far it's offset is.


Yeah, that's what I've been doing. It's not ideal since the shadow is usually still a bit misplaced because the objects don't match exactly, and it's a pain finding the right thing to clone. I'm looking into whether PosOffset can be calculated manually and will share the results if I find anything.
Virtual gardener
staff: administrator
#6 Old 30th Jun 2016 at 9:44 PM
i'll take a look around as well, since it got me pretty curious since there are people out there who knows but never shared >-< But I was thinking if it could have been anything like PosOffset too, but I only found those for the normal meshes. Although I understand what you want to find out with the PosOffset.

So I'll take a look around as well and see if I find anything too ^-^
Virtual gardener
staff: administrator
#7 Old 1st Jul 2016 at 9:14 PM
@butterbot, seems like Bloombase's tutorial did explain about the sunshadows just really vague.

So an object with the height of the garden gnome has to be set as *origin in the scale option and then 2,2,2 (as in XYZ). Then, lower it to the end of that plane setting Bloombase uses (like the bottom) and that seems to be it. Else I guess the only thing you can do is using references >-< (cloning an object in S3OC and use the shadow mesh as reference)
Instructor
Original Poster
#8 Old 2nd Jul 2016 at 12:56 AM
Thanks for looking into this. The part of the tutorial you quoted explains how to scale and position the shadow mesh itself (the same process that is automated by the Blender plugin), not how to get the values that go into PosOffset.

The PosOffset does not seem to directly describe the displacement of the shadow mesh with regard to the origin, but rather some kind of parameter related to the material definition that's associated to the shadow mesh, possibly something to do with determining where the actual shadow projection should be rendered in-game. This can be seen by opening the sunshadow MLOD in S3PE's Grid view --> Chunk 5 --> RCOLBlock --> Mtnf -->SData 2.

Just positioning and scaling the shadow mesh correctly (using the tutorial or the Blender plugin) is not sufficient for the sunshadow to show up properly in-game; the PosOffset must be correct as well. Unfortunately, S3PE doesn't recalculate the PosOffset when a sunshadow MLOD is imported.
Instructor
Original Poster
#9 Old 25th Sep 2016 at 10:44 AM
I'm resurrecting this thread to keep all the info in one place.

I found a way to calculate PosOffset values that are very close to EA's--likely good enough to use in-game. However, that alone is not sufficient to place the projected sunshadow from the shadow mesh in the correct location.

As a test, I made two copies of an object. TSRW was used to generate the shadow mesh + PosOffset for one of the copies. Separately, I used the Blender plugin to generate a shadow mesh for the second copy and manually calculated its PosOffset, which I wrote to the .package using S3PE. This second, manually assembled copy was then opened in a separate instance of TSRW, in order to see if its sunshadow matches the one generated by TSRW in the first copy.

Despite the PosOffset values being practically identical in both cases, the manually assembled sunshadow did not project in a correct fashion. However, I noticed that the PosScale values differed between the two files. When the TSRW-generated PosScale from the first file was copied into the second file, the second sunshadow (with the manually calculated PosOffset) finally projected correctly, basically matching the automatically generated one. So it seems that PosScale is also crucial in determining the proper projection, and both PosOffset and PosScale must be correct for the shadow to be right.

Now to figure out how to calculate PosScale...

Own Grandma's Canning Station? Check out the Canning Station Overhaul.
Like doing laundry? Check out the Infinite Laundry Buffs Fix.
Instructor
Original Poster
#10 Old 26th Sep 2016 at 9:34 AM
Worked out how to calculate PosScale! It's more straightforward than PosOffset. Will pop the test object into the game to make sure it works.

Own Grandma's Canning Station? Check out the Canning Station Overhaul.
Like doing laundry? Check out the Infinite Laundry Buffs Fix.
Virtual gardener
staff: administrator
#11 Old 26th Sep 2016 at 6:39 PM
This is so awesome! I'm wondering how you calculated the PosScale, I'm really curious ^.^
Instructor
Original Poster
#12 Old 27th Sep 2016 at 8:08 AM
@Greenplumbbob

Got a chance to test the object in-game, and the sunshadow looks great. While TSRW's autogeneration is the easiest way to do this, it's useful to have an alternative method to obtain a proper sunshadow, since TSRW cannot edit certain things (e. g. Store items, some special objects) and the latest versions seem to neglect compatibility with TS3 files in favour of TS4, so there's no telling if support for TS3 will continue in the future.

The manual calculation of PosOffset + PosScale is not difficult, just a bit long. I plan on writing a tutorial for it when I've got some time.

Own Grandma's Canning Station? Check out the Canning Station Overhaul.
Like doing laundry? Check out the Infinite Laundry Buffs Fix.
Virtual gardener
staff: administrator
#13 Old 28th Sep 2016 at 5:51 PM
To be honest I kinda gave up on TSRW theses days when it comes to fixing things. Because... well it's been? almost a year? Looking at the export/import script, it looks like the data that it keeps is not sims 3 compatible, or a part of it not to be sims 3 compatible and for some reason they just keep releasing their own new versions with some adjustments on the program itself, but the sims 3? Why fix that!?

Anyway! For store items, you could if you bypass some stuff when editing store items, but I didn't know that. But I'm looking forward to the tutorial!
Instructor
Original Poster
#14 Old 15th Oct 2016 at 10:31 PM
Back to top