Changing asset files / reference resource

(5 posts) (3 voices)
  • Started 11 months ago by Octarina
  • Latest reply from Octarina
  1. Octarina

    member
    Joined: May '13
    Posts: 43

    Hello

    In trying to optimise my project for web, I manually resized and compressed a number of .tga textures (12mb each) from an external model library into .png files (1 mb each). I dragged and dropped these new textures into 3DVIA studio, and then reassigned these new textures to the correct materials. I then deleted the old .tga files.

    Everything appears fine when I play the experience, but every time I start the project I see these errors:

    [ERROR] [file:E:/WS/StudioDP10_B5/VIAMPFoundation/vkKernel.m/src/vkResourceManager.cpp] [line="1179"] ERROR (Could not load asset file:///C:/Projects/Mee/trunk/Scratch/Sources/Textures/cellphone_01_specular.tga :) (Cannot find the element:-8) [function:VKernel::vkResourceManager::LoadAsset]
    [ERROR] [file:E:/WS/StudioDP10_B5/VIAMPFoundation/vkKernel.m/src/vkAssetSerializationContext.cpp] [line="173"] Could not find referenced resource ../Textures/cellphone_01_specular.tga?cat=Texture&Managed=false&cat=Texture#cellphone_01_specular

    I get the same errors when I export to 3DVIA.com.

    I tried searching for references to the old .tga files in the Project Build Explorer, but they are not there.

    Should I be worried?

    Thanks!

    Posted 11 months ago #
  2. flamenco

    3DVIA Studio Guru
    Joined: Sep '09
    Posts: 148

    Hi,
    I cannot read the full error message, could you send it again ?
    - If the textures appear correctly inside the player, then everything should be fine
    - You could also replace textures references inside the DAE text file before re-impprting it inside Studio, that would avoid manual replacement.
    - Just my two cents: .jpg should provide more compression than .png for web deployment ?

    If assets come from 3DSMax, here is a quick script I wrote to batch convert all textures of a 3DSMax scene from one format to another format, you might find it useful ? (BACKUP your scene / project directory before launching it)

    -- Script description:
    -- Converts all scene maps from srcFormat to dstFormat
    -- Changes slot reference, and saves file to the new file format in original directory
    -- Tested on 3DSMax2009 english

    -- User manual
    -- Open Script: MaxScript Menu / Open Script / Open "convert_maps.ms"
    -- Open Listener: Mascript Menu / Maxscript Listener (or F11)
    -- Evaluate scrip: Tools Menu in script window / Evaluate All
    -- That should display convert_maps() in listener if everything's OK
    -- Launch script from listener, by typing for instance:
    -- convert_maps "tif" "jpg"

    fn convert_maps srcFormat dstFormat =
    (
    format "START replacing '%' by '%'..\n" srcFormat dstFormat

    -- Loop all maps
    allMaps = getClassInstances BitmapTexture
    for currentMap in allMaps do
    (
    mapFilename = currentMap.filename
    mapFullPath = mapPaths.getFullFilePath mapFilename
    mapPath = getFilenamePath mapFullPath
    mapFile = getFilenameFile mapFilename
    mapType = replace (getFilenameType mapFilename) 1 1 ""
    format "\tprocessing '%':\n" mapFilename
    if toLower mapType == toLower srcFormat then
    (
    mapBitmap = currentMap.bitmap
    savePath = mapPath + mapFile + "." + dstFormat
    mapBitmap.filename = savePath
    currentMap.filename = savePath
    save mapBitmap
    format "\t\tmap reference changed, file converted and saved to: %\n" savePath
    )
    else
    format "\t\tformat don't match '%'\n" srcFormat
    )
    format ".. END OF IT\n"
    )

    Cheers,
    Arnaud.

    Posted 11 months ago #
  3. Octarina

    member
    Joined: May '13
    Posts: 43

    Oops, sorry about the cut-off error message, let me try again:

    [ERROR] [file:E:/WS/StudioDP10_B5/VIAMPFoundation/vkKernel.m/src/vkResourceManager.cpp]
    [line="1179"] ERROR
    (Could not load asset file:///C:/Projects/Mee/trunk/Scratch/Sources/Textures/f003_head_color.tga :)
    (Cannot find the element:-8)
    [function:VKernel::vkResourceManager::LoadAsset]
    
    [ERROR] [file:E:/WS/StudioDP10_B5/VIAMPFoundation/vkKernel.m/src/vkAssetSerializationContext.cpp]
    [line="173"]
    Could not find referenced resource ../Textures/f003_head_color.tga?
    cat=Texture&Managed=false&cat=Texture#f003_head_color

    Unfortunately, I receive the models already packed as .mppack, so the COLLADA option is not immediately available to me (don't worry, I'll definitely be communicating the need to optimize the textures back up the production chain).

    Otherwise, everything appears fine, and exports to 3DVIA.com ok as well. I just like to have a nice clean build wherever possible

    Posted 11 months ago #
  4. iainB85

    Interplanetary Delivery Boy
    Joined: Jun '08
    Posts: 515

    I usually get these kind of errors when there are left over configurations in my stage to these references (they don't always clean up nicely).

    You can find the stage XML files in /Sources/Stages of your project. and manually edit them if you are feeling adventurous.

    -- BEFORE EDITING ANY OF THIS BACKUP YOUR FILES AS IT'S VERY EASY TO MESS UP THEN YOUR ENTIRE STAGE WON'T LOAD IF THE FILE IS NOT CONFIGURED CORRECTLY --

    For instance, I might have something like:

    <item>
    <compUci>:</compUci>
    <compConfiguration id="21657_0x11771248" scope="asset" create="vkConfiguration">
    <item path="vkNode2D.Material" type="vkSmartPtr<vkMaterial>" ref="../Templates/Node2DTextured.mpxml#2DMaterialWithTex"/>
    <item path="vkActor.ComponentID" type="vkString">pivotLayer</item>
    <item path="vkNode2D.ComponentID" type="vkString">pivotLayer</item>
    <item path="vkNode2D.Color.a" type="uint8">0</item>
    <item path="vkNode2D.Texture" type="vkSmartPtr<vkTexture>" ref="../Textures/pivotIcon.png?cat=Texture#pivotIcon"/>
    <item path="vkNode2D.Position.x" type="float">606.0</item>
    <item path="vkNode2D.Position.y" type="float">294.0</item>
    <item path="vkNode2D.Pickable" type="bool">false</item>
    <item path="vkNode2D.Size.y" type="float">35.0</item>
    <item path="vkNode2D.Size.x" type="float">35.0</item>
    </compConfiguration>
    </item>

    Let's say I deleted the "pivotIcon" texture, but my behavior is still trying to reference it (this could result in a similar kind of error). I can manually delete that to clean it up.

    Be weary though, some categories have a count on them, so if you delete a reference you also need to subtract from the count of that category as well, like this:

    <resources count="13">
    <item ref="../Textures/zoomIconSprite.PNG?cat=Texture#zoomIconSprite"/>
    <item ref="../Textures/panIconSprite.PNG?cat=Texture#panIconSprite"/>
    <item ref="../Textures/rotateIconSprite.PNG?cat=Texture#rotateIconSprite"/>
    <item ref="../Textures/rotationIconSprite.PNG?cat=Texture#rotationIconSprite"/>
    <item ref="../Textures/pivotIcon.png?cat=Texture#pivotIcon"/>
    <item ref="$(RootDataURI)Shaders/pplBlinn.fx?cat=Shader#pplBlinn"/>
    <item ref="../Shaders/pvlPhong-WireframeOnShaded.fx?cat=Shader#pvlPhong-WireframeOnShaded"/>
    <item ref="../Shaders/WireframeNoShade.fx?cat=Shader#WireframeNoShade"/>
    <item ref="../Shaders/pplPhong-WireframeOnShaded.fx?cat=Shader#pplPhong-WireframeOnShaded"/>
    <item ref="../Shaders/pplBlinn-WireframeOnShaded.fx?cat=Shader#pplBlinn-WireframeOnShaded"/>
    <item ref="../Shaders/pvlBlinn-WireframeOnShaded.fx?cat=Shader#pvlBlinn-WireframeOnShaded"/>
    <item ref="$(RootDataURI)Shaders/pvlPhong.fx?cat=Shader#pvlPhong"/>
    <item ref="$(RootDataURI)Shaders/pplPhong.fx?cat=Shader#pplPhong"/>
    </resources>

    Posted 11 months ago #
  5. Octarina

    member
    Joined: May '13
    Posts: 43

    Hi Iain

    Thanks for the tip, I'll check it out!

    Posted 11 months ago #

Reply

You must log in to post.