Forum Announcement, Click Here to Read More From EA_Cade.

@SimGuruModSquad 0xDB43E069 DeformerMap resource?

Comments

  • Options
    cmarinetticmarinetti Posts: 147 Member
    @SimGuruModSquad - If we could get a bt for the SimHotspotControl that would be great, thanks! I see the CASHotSpotAtlas is a DST5 compressed DDS image and I'm wondering if using an uncompressed DDS would be possible and if so whether that would help with the precision problem.

    @simmythesim - Awesome work! Are you expanding the slider effect by multiplying all the pixel values? Or do you have a method of applying a modified mesh to the data? I was wondering about doing that but the displacement values would have to be 'smeared' across the image so to speak to work with different meshes. Either way, this is very exciting and I'm looking forward to seeing more!

    BTW, the next version of s4pe (0.4.2) will display more useful information from the DeformerMap resource and allows export as an image. I don't know how useful import from an image would be but it's certainly doable.
    cmarNYC on MTS.
  • Options
    simmythesimsimmythesim Posts: 153 Member
    edited January 2016
    cmarinetti wrote: »
    @SimGuruModSquad - If we could get a bt for the SimHotspotControl that would be great, thanks! I see the CASHotSpotAtlas is a DST5 compressed DDS image and I'm wondering if using an uncompressed DDS would be possible and if so whether that would help with the precision problem.

    @simmythesim - Awesome work! Are you expanding the slider effect by multiplying all the pixel values? Or do you have a method of applying a modified mesh to the data? I was wondering about doing that but the displacement values would have to be 'smeared' across the image so to speak to work with different meshes. Either way, this is very exciting and I'm looking forward to seeing more!

    BTW, the next version of s4pe (0.4.2) will display more useful information from the DeformerMap resource and allows export as an image. I don't know how useful import from an image would be but it's certainly doable.

    I'm multiplying the slider effect by applying a complex algorithm that would confuse even the greatest of minds. Just kidding, what I did at first was multiply all the values by 2 (or 0.5, if they were below 128), but it caused some horrifying looking sims, so in the final version, it multiplies it based on how far away from 128 it is.

    All is good now, the sliders have been expanded, except that the randomly generated sims look horrible as the limits are the same, but the range has been expanded. So, you can get some randomly generated freakishly looking sims,

    Creating a DMap file from an image integrated into S4pe would be handy! I currently use three programs to create custom DMaps currently, not counting blender. Adding that to S4pe would save me a few minutes of annoyance at why my program isn't working.

    Let me explain how I can create custom DMaps.

    First, I get the difference between two sim models, one the "base" and one the "modified", to get the data needed for the DMap using two blender scripts.

    Then, I use a program I wrote to chug through a lot of lines of data to find the changed vertices.

    After that, I get the changed vertices then change the color of the pixel associated with that vertex on a new image to an RGB value matching its XYZ vertex difference.

    IU9Y4eE.png
    (Zoom in, the representations of the vertices are quite small, each dot is a vertex.)

    Using a GIMP interpolation plugin, I then proceed to interpolate between each point on the image to get a nice looking DMap image. I cut off some irrelevant parts, like the upper half of the face, and then proceed to put it through my DMap writer application.


    The application takes a few seconds to complete, and there! You get a nice new DMap resource. Put it in the game by overriding another resource to see how it behaves ingame!

    Let's say that this can change literally anything about a sim's appearance, anything is possible! As long as you don't move from the skeleton too far away that is.
  • Options
    cmarinetticmarinetti Posts: 147 Member
    TS3 uses morph meshes consisting of the difference between a base mesh and a modified mesh, so that part is very familiar. :) Very clever to use GIMP to interpolate between the points! Should be possible to do that in code, I imagine.

    I'll take a look at importing the dmap images in s4pe. :)
    cmarNYC on MTS.
  • Options
    SimGuruModSquadSimGuruModSquad Posts: 597 Member

    Can SimModifier files modify a sim's attributes without a SimHotspotControl pointing to them?

    If so, then I could use the script I made in the "Accessing CAS Modifiers from script" post (this,if you were wondering) to modify the slider value without touching the UI at all.

    Yes that should work, SimModifiers do not need to be connected to a SimHotspotControl. Given what you have working currently, it should be relatively straightforward to add a new SimModifier and write a cheat to activate it.

    Took a closer look at the code and unfortunately the concept of the RGBA values in the CASHotSpotAtlas being separated by 10 is hard coded in C++, so increasing the number of indexable SimHotspotControls indexable may not be doable.

    I will post the .bt file for SimHotspotControls in the next week or so.

    -SGMS
  • Options
    simmythesimsimmythesim Posts: 153 Member
    edited January 2016

    Can SimModifier files modify a sim's attributes without a SimHotspotControl pointing to them?

    If so, then I could use the script I made in the "Accessing CAS Modifiers from script" post (this,if you were wondering) to modify the slider value without touching the UI at all.

    Yes that should work, SimModifiers do not need to be connected to a SimHotspotControl. Given what you have working currently, it should be relatively straightforward to add a new SimModifier and write a cheat to activate it.

    Took a closer look at the code and unfortunately the concept of the RGBA values in the CASHotSpotAtlas being separated by 10 is hard coded in C++, so increasing the number of indexable SimHotspotControls indexable may not be doable.

    I will post the .bt file for SimHotspotControls in the next week or so.

    -SGMS

    Hey @SimGuruModSquad! Can you explain how I would "activate" the new SimModifier resource? I've created two new files, one a SimModifier file, and the other the DMap file. Putting it in the game doesn't seem to do anything though. I have a cheat that writes all slider resources used for the sim to a file, and it seems that my slider isn't appearing in the list of SimModifiers for that age and gender. Is there anything I'm missing?

    Also, can you explain what the Public Key, External Key, Delay Load Key do and what the file format 0x067CAA11 does?
    Post edited by simmythesim on
  • Options
    SimGuruModSquadSimGuruModSquad Posts: 597 Member
    Hi @simmythesim I was thinking that you could just add the instance for your new SimModifier to the BlobSimFacialCustomizationData protobuf via Python and that would activate it. Did you try that? It's certainly possible there is more to it than that.

    The ContextData that wraps some resources and has a few purposes:
    * Allows multiple resources to be bundled together.
    * Defines what resources are in the bundle (Public Keys)
    * Defines what external resources are referenced by the bundle, and should be loaded before this resource (External Key)
    * Defines what external resources are referenced by the bundle, but do not need to be loaded to initialize the bundle (DelayLoad Key)

    Some resources take more advantage of these ContextData features than others. It's best to look at how Maxis authored content is using context data and emulate that. In the case of Sims Modifier resource for example there is not much to do, just add the one single public key.

    Resource 0x067CAA11 is a Blend Geometry resource. The Sims's geometry is actually impacted by three things 1) Dmaps (for body modifications and gross changes to head shape), 2) Blend Shapes (for facial detail) and 3) Bones (primarily for the breast). This resource defines the blend shapes.

    -SGMS
  • Options
    simmythesimsimmythesim Posts: 153 Member
    edited January 2016
    EDIT 2: @SimGuruModSquad, I've edited the last script with help from Google Documentation, and it's so close to working! This is my new code,
    @sims4.commands.Command("add_slider", command_type=sims4.commands.CommandType.Live)
    def randomize_facial_attributes(key:int, amount:float, opt_sim:OptionalSimInfoParam=None, _connection=None):
        ScumLog.log("1")
        sim_info = get_optional_target(opt_sim, target_type=OptionalSimInfoParam, _connection=_connection) 
        ScumLog.log("2")
    
        if sim_info is None:
            return False
        
        facial_attributes =  protocolbuffers.PersistenceBlobs_pb2.BlobSimFacialCustomizationData()
        facial_attributes.MergeFromString(sim_info.facial_attributes)
        modified_facial_attributes = protocolbuffers.PersistenceBlobs_pb2.BlobSimFacialCustomizationData()
        ScumLog.log("3")
    
        stuff = protocolbuffers.PersistenceBlobs_pb2.BlobSimFacialCustomizationData().Modifier()
        stuff.key = key
        stuff.amount = amount
        ScumLog.log("4")
    
        modified_facial_attributes.body_modifiers.append(stuff)
        ScumLog.log("5")
    	
        for modifier in facial_attributes.face_modifiers:
             modified_facial_attributes.face_modifiers.append(modifier)
    			 
    			 
        for modifier in facial_attributes.body_modifiers:
            modified_facial_attributes.body_modifiers.append(modifier)
    	
        ScumLog.log("6")
    
    	
        sim_info.facial_attributes =  modified_facial_attributes.SerializeToString()
        return True
    

    The ScumLog is just a neat little module made by Scumbumbo for writing debugging information. Anyway, the game crashes when it serializes the facial attributes with the slider added. The following input is what caused it to crash, if it helps.
    add_slider 10033447967879980645 1.0
    

    10033447967879980645 is just the hexadecimal instance number of the custom SimModifier resource converted into an int, and 1.0 is the number to which to set the value to.
    Post edited by simmythesim on
  • Options
    simmythesimsimmythesim Posts: 153 Member
    edited January 2016
    @SimGuruModSquad
    Pretty important bug I've found. if it is actually one. It seems that the DMaps for Normals do not work oddly enough.

    Disclaimer, I've only tested this on the Fitness DMap so this may or may not be broken on other DMaps.

    First, I removed the fitness texture for YA Male sims, to more clearly show the difference. I replaced the Fitness DMap Normals with a blank one with all values at 128. Then, I removed it and compared between them.

    The Normals DMap does not have any effect.
    v8ecRye.png

    I was actually working on a mod that would modify the Fitness Normals so that the abs part would look less like a picture plastered on a body and more of, well, abs. Anyway, after testing repeatedly for a few hours to see what my newly generated DMap normals effect had, I noticed that it wasn't doing anything and so, I made a comparison.

    Hope that you can fix this if this is a bug, because it's a pretty major one, if it is.

  • Options
    SimGuruModSquadSimGuruModSquad Posts: 597 Member
    Hi @simmythesim,

    The Sim lighting in CAS and in game is tuned such that the normals don't have a huge impact. This is probably why you are not noticing any difference. You could try overriding with a very extreme normal dmap and you’d probably notice a change. You could also try taking the Sim in game an placing in a dark room with a single light and that might make it more obvious.

    Also keep in mind that these are vertex normals – I expect that the density of geometry around the abs is not nearly dense enough to give you the detail you are looking for.

    -SGMS
  • Options
    simmythesimsimmythesim Posts: 153 Member
    edited January 2016
    Hi @simmythesim,

    The Sim lighting in CAS and in game is tuned such that the normals don't have a huge impact. This is probably why you are not noticing any difference. You could try overriding with a very extreme normal dmap and you’d probably notice a change. You could also try taking the Sim in game an placing in a dark room with a single light and that might make it more obvious.

    Also keep in mind that these are vertex normals – I expect that the density of geometry around the abs is not nearly dense enough to give you the detail you are looking for.

    -SGMS

    @SimGuruModSquad Thanks! Any idea on what's causing my new python script that adds the new sim modifier to the sim to crash the game?
    Post edited by simmythesim on
  • Options
    SimGuruModSquadSimGuruModSquad Posts: 597 Member
    Hi @simmythesim,

    Your script looks fine, and it worked fine for me - I can change a yf Sim to be thin with the following command:
    |add_slider 10198741902962671628 1.0
    
    No crashes encountered. Of course this is using an existing Sims Modifier and DMAP data, my guess is the crash is caused by something wrong with your Sim Modifier data.

    -SGMS
  • Options
    simmythesimsimmythesim Posts: 153 Member
    Hi @simmythesim,

    Your script looks fine, and it worked fine for me - I can change a yf Sim to be thin with the following command:
    |add_slider 10198741902962671628 1.0
    
    No crashes encountered. Of course this is using an existing Sims Modifier and DMAP data, my guess is the crash is caused by something wrong with your Sim Modifier data.

    -SGMS
    @SimGuruModSquad
    Is there a way to tell if a resource has been loaded in game? It seems that it doesn't read it in the first place.
  • Options
    SimGuruModSquadSimGuruModSquad Posts: 597 Member
    Hi @simmythesim ,

    There is no easy way to tell if it has been loaded, what makes you think that it's not being loaded? If you could provide the full mod, I could take a closer look.

    -SGMS
  • Options
    simmythesimsimmythesim Posts: 153 Member
    Hi @simmythesim ,

    There is no easy way to tell if it has been loaded, what makes you think that it's not being loaded? If you could provide the full mod, I could take a closer look.

    -SGMS

    It seems that there was an error in the python script. Anyway, I fixed it, and ta-da! It works...almost. It seems that the resource is being read, but it doesn't seem to be applying the DMap data correctly. If I enter random numbers for the slider to add, nothing happens. If I add any new custom slider, like the Move Sim Vertices slider from a while back, causes this to happen.

    Before Applying Slider through Python
    RrGFPvm.png

    After
    8h0imda.png
    I tested this on several other sims, and all of them had gained weird normals and different facial structures, even when all I wanted to do was move most of the sim vertices forward!

    Perhaps something's missing?

    Download Link, and since the forum is being annoying and blocking all google drive links, here it is with spaces and "." replaced with "DOT"!
    driveDOTgoogleDOTcom/file/d/0By8EGh_5mosnZ1NLMlBKVkJhMVk/view?usp=sharing

  • Options
    SimGuruModSquadSimGuruModSquad Posts: 597 Member
    Hey @simmythesim,

    The first issue I discovered is that dmaps resources do not work with a non-zero group. I'd suggest while you're trying to get this going, use 0 for group for all your resources. When things are working, then start setting the top bit of the group to see which resources work and which do not, but for sure dmap resources currently do not.

    Is the dmap in this mod exactly the same as the one that correctly pushes the head forward when you just replace an existing dmap?

    -SGMS
  • Options
    simmythesimsimmythesim Posts: 153 Member
    Hey @simmythesim,

    The first issue I discovered is that dmaps resources do not work with a non-zero group. I'd suggest while you're trying to get this going, use 0 for group for all your resources. When things are working, then start setting the top bit of the group to see which resources work and which do not, but for sure dmap resources currently do not.

    Is the dmap in this mod exactly the same as the one that correctly pushes the head forward when you just replace an existing dmap?

    -SGMS

    The DMAP in this mod is a DMap that pushes all the sim vertifces from the neck down forward, which is exactly the same as when I replace an existing one.

    I've changed it the group to 0, but I think it's just not being loaded properly... see why below.

    I think it's not being read, is because if I enter any random number within the same range of the existing DMap resources, it causes the same odd facial structure and odd normals on the sim, which leads me to believe that it is loading a placeholder SimModifer and DMap (or perhaps a default sim template?) when it can't find one that belongs to the SimModifier entered.
  • Options
    Agent48mk2Agent48mk2 Posts: 22 Member
    Great now just have to wait a week until someone replies.
  • Options
    SimGuruModSquadSimGuruModSquad Posts: 597 Member
    edited February 2016
    Hey @simmythesim,

    The problem is that you are not specifying a key for the normal dmap, it needs to be a valid key. Also note that the shape dmap and normal dmap need to have the same min/max row and col value.

    I was able to get your mod to look more correct once supplying a valid normal dmap:

    mz5R7yl.jpg

    Hope that helps,
    SGMS
  • Options
    simmythesimsimmythesim Posts: 153 Member
    Hey @simmythesim,

    The problem is that you are not specifying a key for the normal dmap, it needs to be a valid key. Also note that the shape dmap and normal dmap need to have the same min/max row and col value.

    I was able to get your mod to look more correct once supplying a valid normal dmap:

    mz5R7yl.jpg

    Hope that helps,
    SGMS

    I thought I could just leave the Normal DMap space empty, anyway, thanks for the help! Will report my experiments later!
  • Options
    IngeJonesIngeJones Posts: 3,247 Member
    I feel as if I'd like to let go of the top of his head and see it catapult across the lot :)
  • Options
    simmythesimsimmythesim Posts: 153 Member
    It works! Since custom sliders are now possible, I'll be releasing my DMAP writer program as soon as I can make it user friendly.
  • Options
    Agent48mk2Agent48mk2 Posts: 22 Member
    > @simmythesim said:
    > It works! Since custom sliders are now possible, I'll be releasing my DMAP writer program as soon as I can make it user friendly.
    Pls keep us updated.
  • Options
    FishinabarrrelFishinabarrrel Posts: 11 New Member
    Yes > @Agent48mk2 said:
    > > @simmythesim said:
    > > It works! Since custom sliders are now possible, I'll be releasing my DMAP writer program as soon as I can make it user friendly.
    > Pls keep us updated.
    >
    >

    Yes please. Keep us updated ^^
  • Options
    Agent48mk2Agent48mk2 Posts: 22 Member
    The guy is gone.
  • Options
    cmarinetticmarinetti Posts: 147 Member
    @SimGuruModSquad - I see there is now a new version (7) of the DeformerMap resource. Would it be possible to get a bt for it?
    cmarNYC on MTS.
This discussion has been closed.
Return to top