Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] Object texture stages and UV scales

Author
Message
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 18th Sep 2020 13:45
Hey everybody!

Whenever I have multiple texture (stages) on an object, I can only change the UV scales of stage 0, even tho the command includes all stages. Is that correct or am I missing something?

Thanks!
Regards Sph!nx

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 18th Sep 2020 22:17
Are you passing the texture stage to the function?
Are you using the standard shader?
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 18th Sep 2020 22:23 Edited at: 18th Sep 2020 22:57
Hey Blink0k!

I'm not using a shader (not familiar with shaders) and I do not know what you mean by "passing it to the function". I'm just testing some stuff.

Here is a snippet of my code:



Edit:
Ohw, the object that it is applied to is a heightmap object (createobjectfromheightmap).

Any more help is much appreciated!
Regards Sph!nx
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 18th Sep 2020 23:29 Edited at: 18th Sep 2020 23:30
I could be missing something here, and would love to be corrected otherwise, but I believe you are only able to set the image on one stage if you have the default shader running (the SetObjectMeshNormalMap() uses stage 2.) It is my understanding a shader will combine/layer these stages onto the object. You can use SetObjectMeshImage() to apply different images.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Sep 2020 03:06 Edited at: 19th Sep 2020 03:07
SetObjectUVScale accepts a value between 0 and 1. It is the textures relative scale to the object. A value of 1 means the texture fills the object. A value of .25 means the texture is repeated 4 times.
I'm not sure if it clamps at 1
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 19th Sep 2020 11:13
Hey guys!

Wrote another small, cleaner test. Still no success. Here is the code. I've marked the line that's giving me troubles.



I'm probably missing something simple...
Regards Sph!nx
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Sep 2020 11:22
What happens when you set stage 0 to 16, 16
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 19th Sep 2020 11:26
Hey, thanks for the quick response.

When I edit stage 0, all other stages will scale with it. I'm beginning to think this might be a bug...
Regards Sph!nx
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 19th Sep 2020 17:51
SetObjectUVScale() modifies all the meshes of the object, you only have one object so maybe this is correct? Are your two textures different sizes and is it possible to fix that with an image editor? Would SetImageWrap help align the second texture?
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 19th Sep 2020 18:03
Yep, I have set imagewrap for the detail map. The idea is to have quite a large height-map and diffuse map scale and then add a detail layer with a much smaller scale to add detail pixels to match the objects I intend to place around.

Still no success

Regards Sph!nx
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 20th Sep 2020 00:55 Edited at: 20th Sep 2020 01:02
This post has been marked by the post author as the answer.
Here is a shader janbo helped with a while back it does exatcly what you want two texture stages two different uv scales. Can thank BlinkOk for letting me know. here is some code im not sure if its functional or not but give it a try


you can see here the floor in the hall and the jail cell is tiled dirt and stone but it has a stretched dirty grunge texture over both that breaks up the tiling so it doesnt look so artificial


Attachments

Login to view attachments
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 20th Sep 2020 12:56 Edited at: 20th Sep 2020 14:08
Thanks smerf! I will download and take a look at it. Much appreciated, mate!

Edit:
Shaders are written in C++ right? I have no experience with it. Does anyone can point me to a tutorial on how to use shaders?
Regards Sph!nx
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 20th Sep 2020 16:05
Shaders are written in glsl. All you need to do is load two images and load the shader to apply the shader to an object and apply an image to the object in stage zero and stage three. You may need to edit the file and notepad to change the scaling of stage 3

Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 20th Sep 2020 16:29
Thank you very much, smerf. I got it working!

I do need to learn more of GLSL to fully understand it. Lol.
Regards Sph!nx

Login to post a reply

Server time is: 2024-04-26 09:41:42
Your offset time is: 2024-04-26 09:41:42