[2.1] How to scale a roughness texture

Problems building or running the engine, queries about how to use features etc.
Post Reply
Feanor16
Halfling
Posts: 46
Joined: Tue Feb 18, 2014 10:49 pm

[2.1] How to scale a roughness texture

Post by Feanor16 »

Hi,
i’m working on Ogre 2.1 and i’m making a material.json. I see that only the detail_diffuse0 and the detail_normal0 can use the scale on a texture. I would like to know if that’s possible to use a scale on my roughness texture.

this is my json file:

Code: Select all

{
	"samplers" :
	{
		"Sampler_0" :
		{
			"min" :"anisotropic",
			"mag" :"anisotropic",
			"mip" :"anisotropic",
			"u" : "wrap",
			"v" : "wrap",
			"w" : "wrap",
			"miplodbias" : 0,
			"max_anisotropic" : 1,
			"compare_function" : "disabled",
			"border" :[1, 1, 1, 1],
			"min_lod" :-3.40282e+38,
			"max_lod" :3.40282e+38
		},
	},

	"macroblocks" :
	{
		"Macroblock_0" :
		{
			"scissor_test" : false,
			"depth_check" : true,
			"depth_write" :true,
			"depth_function" : "less_equal",
			"depth_bias_constant" : 0,
			"depth_bias_slope_scale" : 0,
			"cull_mode" : "clockwise",
			"polygon_mode" : "solid"
		}
	},

	"blendblocks" :
	{
		"Blendblock_0" :
		{
			"alpha_to_coverage" : false,
			"blendmask" : "rgba",
			"separate_blend" : false,
			"src_blend_factor" : "one",
			"dst_blend_factor" : "zero",
			"blend_operation" : "add"
		},
	},

	"pbs" :
	{
		"materialA" :
		{
			"macroblock" : "Macroblock_0",
			"blendblock" : "Blendblock_0",
			"shadow_const_bias" : 0.01,
			"workflow" : "specular_ogre",

			"detail_diffuse0" :
            		{
                		"mode" : "NormalNonPremul" ,
                		"offset" : [0, 0],
                		"scale" : [2, 2],
                		"value" : 1,
                		"texture" : "diffuse.png",
                		"sampler" : "Sampler_0",
               	 		"uv" : 0
            		},

            		"detail_normal0" :
            		{
              			  "offset" : [0, 0],
              			  "scale" : [2, 2],
             	 		  "value" : 1,
            	  		  "texture" : "normal.png",
           		   	  "sampler" : "Sampler_0",
          		    	  "uv" : 0
            		},
			"roughness" : 
			{
				"value" : 1.0,
 				"texture" : "roughness.png",
				[b][u]"scale" : [2, 2],[/u] ←Not working[/b]
				"sampler" : "Sampler_0",
				"uv" : 0
			}
		}

	}
}
to explain my problem:

diffuse.png = http://hpics.li/f6c2823
roughness.png = http://hpics.li/ba921d2

but when i use diffuse + normal + roughness, the roughness doesn't scale and display something like this:
Image

The scale doesn't work in the roughness, is there any alternative to make it work?

Thank you for the help
User avatar
king_virtualize
Gnoblar
Posts: 5
Joined: Wed Jan 18, 2017 2:40 pm

Re: [2.1] How to scale a roughness texture

Post by king_virtualize »

Hi,

I have similar problems regarding specular texture scale.
Is 2.1 dev planned to implement these techniques ?

br,
choub
Gnoblar
Posts: 9
Joined: Wed Aug 12, 2015 3:43 pm
x 1

Re: [2.1] How to scale a roughness texture

Post by choub »

Hello everyone,

Sorry for digging up this topic, but I'm a technical 3d artist working with ogre 2.1 and creating materials for 3d models.
I'm facing the same problem as exposed above : roughness/specular map transformation (offset/scaling/rotation).

Here, I want to create a metallic floor 10 by 10 meters, my textures pattern is 1 by 1 meter. The material has a diffuse (1x1), a normal (1x1) and a roughness Map (1x1):
NoTiles.jpg
As I can't set the roughness map scale like the others textures, here is the result :
Tiles.jpg
The detail_diffuse and the detail_normal stretch well and are correctly applied, but the stretching of the roughness map is not applied.
Perhaps a detail_roughness map with the same shader mechanism as the other ones would do the trick.
This "issue" is not only located with the roughness map but also with the specular map.
Currently, to create a material with a scaled roughness map, I need to multiply the size of my unwrap by 10. I wouldn't call that a durable and clean solution.
Scale and offset settings are quite useful for graphics designer and this lack of continuity between normal/diffuse map and roughness/specular map could be considered an issue.

Did I miss an implementation of this technique in the Ogre 2.1 documentation ?
Is there a reason for this missing part or maybe a better way to perform this transformation on the roughness map ?

Should I label this topic as "pull request" ? If anybody has already solved this issue, please give share your wiseness and knowledge with the Ogre population :lol:
I would be glad to have working a piece of (shader) code to call in my code.

As an extended topic, I wonder if this issue could be generalized to the use of decals with all the maps.
I'd like to create a plane with a grass part and a mud part using a decal map. Each part will have their associated textures, and the decal map could decide the proportion for every "map" : Diffuse/Albedo, Height, Ambiant Occlusion/ Normal/ Roughness/ Specular ...
I know it is already possible to perform this kind of operation with the diffuse and the normal (detail 0 to 9), I dream of the ability to extend this to the other ones and create amazing grass/mud planes :mrgreen:

Thanks for the reading, hope you have some ideas/answers !
Have a good day ;)
Post Reply