Announcements
The Scaleform forum is now read-only. Please head to the Gamedev site for product support.
Scaleform Forum (Read Only)
Scaleform enables developers to leverage the power of the Adobe® Flash® tool set to create powerful user interface environments for video games.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ReplaceTexture Mirrored Issue

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
Anonymous
773 Views, 11 Replies

ReplaceTexture Mirrored Issue

We have found that using ReplaceTexture results in the image appearing flipped or mirrored.

After locating this example https://autodesk.app.box.com/s/cahanm463luoy7fjpfj3we followed the example an created a second texture, derived from the first, that flips the image to correct this issue.

Whilst the image now displays correctly, it only occupies the top left quarter of the bitmap object and repeats the last x/y pixel of the texture until the image fills the bitmap's area.

 

Any help would be appreicated

11 REPLIES 11
Message 2 of 12
adam.petrone
in reply to: Anonymous

Hello andyBP,

 

Are you seeing this issue with OpenGL or Direct3D?

 

The ReplaceTexture code imports a new texture and could stretch the image. So if your original image doesn't match the dimensions of the replacement texture, it could get resized in an illogical manner. I would verify the image sizes match across the board from flash to your replacement texture.

 

If that doesn't solve the issue, feel free to send in a sample test case for us to investigate.

 

Thanks,

Adam

Message 3 of 12
Anonymous
in reply to: Anonymous

Thanks for the response, but due to these issues, we have decided to work around the problem by loading the required images via actionscript directly. For those interested in an actual solution, this thread is discussing the same issue with more traffic http://forums.autodesk.com/t5/Scaleform-Unity-Development/Texture-flipped-and-mirrored/m-p/4931010

Message 4 of 12
Anonymous
in reply to: Anonymous

Hi I'd just like to add that this is not solved.

 

We used loading directly only to discover it doesn't work at all on Android  - we're loading images that have been downloaded from server by Unity.

 

So now we're stuck, because replace texture just doesn't seem to work. We get the textures but they are stretched or warped and sometimes span a few thousand pixels to far.

 

Has anyone actually got ReplaceTexture to work properly?

 

Thanks

Mike

Message 5 of 12
adam.petrone
in reply to: Anonymous

One cause of the stretching or warping can be a discrepancy in the dimensions. The resolution of the images must match -- or else resizing will take place.

To clarify, in the SWF, the image there must match the image dimensions you intend on replacing it with.

 

 

Does the fact you've downloaded the images have any effect on the result? Are you able to verify they're the same dimensions as you expect in your SWF?

Message 6 of 12
Anonymous
in reply to: adam.petrone

Thanks for your post adam, unfortunately it does not seem to have fixed the issue completely.

 

While ensuring that the dimensions in the swf and the texture match will stop the image from resizing when loaded a second time, it will not display the full image, as can be seen in the images provided (ignoring the background and icons).

 

Can you reproduce this on your end?

 

It almost looks like the texture coordinates (u,v) being used are 0 -> 0.7 rather than 0 -> 1, though I'm not sure if this relavent to how scaleform's method handles this process internally

Message 7 of 12
Anonymous
in reply to: Anonymous

adam, is there a beta version of Scaleform we can try?

 

I saw someone mentioning 4.3f version in another thread...

Message 8 of 12
adam.petrone
in reply to: Anonymous

I cannot reproduce this. Additionally, ReplaceTexture would not directly alter the UVs. It would, as previously mentioned, re-scale the image -- if there are differences in the dimensions.

 

I have a checkerboard texture in different colors. I'm able to replace the texture repeatedly without affecting the texture scale or UVs.

 

Are you sure your object doesn't have a problem with UVs? 

Can you apply that texture to your object from within Unity to verify the entire texture is shown?

 

 

I've attached my checkerboard patterns to this post. These are 128 x 128. Use these to sanity test your object.

 

We do not have a beta of the next version available yet.

 

-Adam

Message 9 of 12
Anonymous
in reply to: adam.petrone

Thanks Adam, Would you be able to send us your test project?

Thanks,

Mike
Message 10 of 12
adam.petrone
in reply to: Anonymous

We have a demo which shows how to use this API. I believe it only has binaries for Windows (d3d9). Below is the download link:

 

ReplaceTextureDemo

 

-Adam

Message 11 of 12
Anonymous
in reply to: adam.petrone

Thanks for the demo, I'm looking at it now.

 

Unfortunately it seems that on my machine the sample crashes when its run, I'm in the process of tracking down the issue at the moment but I was curious as to what version of unity you are using?

 

We're on version 4.5.0b4

 

Message 12 of 12
Anonymous
in reply to: Anonymous

Your example now works on our machines, I don't know what's happened to change that but I accept it.

 

I can see that your example works correctly, and I cannot see anything obvious that's different between our two projects.

 

I'm going to play about with them a bit and see if I can get to the bottom of this, thanks for the working example 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report