Graphics

Reply

Level 2

Level 2
Fungostar
Posts: 17
Registered: ‎09-03-2012
Message 1 of 9 (340 Views)

Texture Coords are clamped ?

Hi all,

 

I hope this doesn't sound like a stupid question...

 

I have a 3D model converted from DirectX format using the ModelConverter Tool, it displays just fine in the Simulator but the texture coordinates seems clamped to 0 - 1.

 

The original model has the coordinates ranging from 0->3 on X and 0->10 on Y... I've analyzed the whole code of the Model loader but seems it's all right, there is no sign of clamping

 

Any clue ?

 

Thanks,

Val

Please use plain text.

Re: Texture Coords are clamped ?

Might be a problem in the shader converter. I just recently had problems with GLSL in another project that was caused by the uniform values being low precision/range. I modified the shader to strictly use highp values in the parts that needed it and my shader worked fine.

Please use plain text.

Level 2

Level 2
Fungostar
Posts: 17
Registered: ‎09-03-2012
Message 3 of 9 (319 Views)

Re: Texture Coords are clamped ?

In this case the shaders are the stock ones, located under ...\SCE\Pss\source\Model\shaders

both values v_TexCoord and a_TexCoord are simply written as "float2" with no indication of being low or high precision :smileysad:
Please use plain text.

Level 2

Level 2
Fungostar
Posts: 17
Registered: ‎09-03-2012
Message 4 of 9 (298 Views)

Re: Texture Coords are clamped ?

Anyone with any kind of suggestion ?

I need either to be able to use UV coords with any range or just post process the UV in the VertexBuffer to adjust them...

HELP !!
Please use plain text.

Re: Texture Coords are clamped ?

 

Have you set the Wrap Mode?

 

i.e. m_texture.SetWrap(TextureWrapMode.Repeat);

 

I have tiled textures working without any problem.

 

I don't use BasicModel any more but you can get at the Model's texture array and set texture parameters.

 

I just manually looped over the array of textures calling SetWrap on each one.

 

Claire

 

 

Please use plain text.

Level 2

Level 2
Fungostar
Posts: 17
Registered: ‎09-03-2012
Message 6 of 9 (256 Views)

Re: Texture Coords are clamped ?

Hi Claire,

it doesn't seems to work... at least not on all objects :smileysad:

I have a model with a number of meshes, one of these mesh has these coords:

MeshTextureCoords {
26;
0.000000; 3.000030;,
0.000000; 0.000000;,
0.000000; 3.000030;,
10.000000; 0.000000;,
0.000000; 3.000030;,
10.000000; 0.000000;,
0.000000; 3.000030;,
10.000000; 0.000000;,
0.000000; 0.000000;,
10.000000; 3.000030;,
10.000000; 0.000000;,
0.000000; 3.000030;,
10.000000; 0.000000;,
10.000000; 3.000030;,
0.000000; 0.000000;,
10.000000; 3.000030;,
10.000000; 3.000030;,
0.000000; 0.000000;,
10.000000; 3.000030;,
0.000000; 0.000000;,
10.000000; 3.000030;,
10.000000; 0.000000;,
10.000000; 0.000000;,
0.000000; 3.000030;,
0.000000; 3.000030;,
0.000000; 0.000000;;
}

they go from 0 to 10 on X and from 0 to 3 on Y because the texture should repeat ten and three times to fill the mesh (it's a volleyball net)

then I did:
sfondo = new BasicModel( "/Application/assets/ns-sfondo.mdx", 0 ) ;
for (int i=0; i<sfondo.Textures.Length; i++)
sfondo.Textures[i].Texture.SetWrap(TextureWrapMode.Repeat);

and nothing... what I see is the texture mapped only once on the net corner, the rest of the net is filled with the last pixel of its texture :smileysad:

but this tecnique works on another mesh in the same model, the difference are the coords which ranges between -2 and +2 more or less

This is driving me mad...

Do you have any other idea ?

Cheers,
Val
Please use plain text.

Re: Texture Coords are clamped ?

Hi Val,

Thank you for your questions. I will have to look into this and update you hopefully in a couple of days.

Out of curiosity, are you able to convert the model into another of the supported formats and then into an MDX through the ModelConverter. I would like to rule out if it is the ModelConverters fault.

Thanks in advance,
James
PlayStation®Mobile Dev Team
Please use plain text.

Level 2

Level 2
Fungostar
Posts: 17
Registered: ‎09-03-2012
Message 8 of 9 (227 Views)

Re: Texture Coords are clamped ?

Hi James,

unfortunately I can't, but if you want I can give you the original Cinema4D model and the exported .X file

Cheers,
Val
Please use plain text.

Re: Texture Coords are clamped ?

Thanks Val, it may be useful later on if its still not working, but we are OK for now I believe.

Please could you confirm that the sizes of your textures are in the power of 2?

In terms of texture wrap modes, you should be aware of the following:
- Repeat mode is not supported for non-power of two textures.
- Initial value of texture wrap mode is ClampToEdge

Thank you.
James
PlayStation®Mobile Dev Team
Please use plain text.
This widget could not be displayed.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。






Recent News