[solved] - one texture - multiple shaders. :?:


(aaa3) #1

is it possible?
im very newb to mapping, some 1 month ago started, and now im working on a prefab soon to release.

if it isnt clear whats my question: i have 1 big texture which contains a lots of things. i want to have different versions of it, e.g. solid, nonsolid, light emitting, et c. Can i have it without making different copies of the texture for each variant (or its regions)? if yes, how?


(kamikazee) #2

If you want a texture to behave differently, you just copy the shader script and set different options in there. Then, you use the new shader name while mapping instead of the old one.

Or do I misunderstand your question?


(Flippy) #3

Do you perhaps mean that you have one large texture that for example covers a piece of terrain, and in the same texture you want one side to behave like grass, and one side to behave like rock, etc, etc…?

Then, no that is not possible.

You might be asking this because you want to merge two textures to create a gradient-seam? That is called Alpha-blending, but that’s perhaps too advanced for someone who only has been mapping for one year…


(aburn) #4

The thing is if you want the texture to repeat and you have like 2 or more parts of it that you want to use in your shader… than you should split them…
(OFC if I understood the question right)

Than for each different shader/stage of your texture you should write… a different shader.

Generally… you have one texture picture… but multiple shaders for it…
or differently… mulltiple shaders use the same texture, which result in different lookalike of the texture… <- THIS IS POSSIBLE

ChearZ, aburn


(aaa3) #5

yes flippy, ty, i c now. no, kamikaze, i wanted to use the same base texture for many different places with different shaders, but in the same map. not just altering it.

(i meant i want to use 1 texture with different behaviours simultaneously). (and not 1 year but 1 month :smiley: ) (btw nothing merge or gadient-seam or idk what, just i have a collection of textures in 1 texture, and for different brushes i use different areas of it. i use this coz the edges must be power or 2 and this provides the most efficient way to store my textures. e.g. the side view and top view of the tank, et c.) now i see i must divide it to more textures. but hehe it soon will be out so u will see what was the problem :wink:
ty help for both of u

[edit] p.s.: while i wrote my answer i saw a new message from aburn; but oops? now it is possible ? its not totally clear to me what are u saying :oops:


(]UBC[ McNite) #6

There s not much use in using one graphics file as many different textures. Of course you can create like 5 shaders using one graphics file, and add different surfaceparms to the shaders, like make it have landmines, then different kinds of step noises, nonsolid, behave like water… but what for?


(aburn) #7

I ment the same what the others said… u can use one texture… NOT a few textures in one file…
And have more than one shader for it… so it would behave differently…

Unless you have a big collection of decals in one file/one texture… than you can use it and allign it on small brushes… but than it would be impossible for it to tile/repeat on the brush, because the texture consists of more than one picture :stuck_out_tongue:


([Cerberus]) #8

If its tripping people out, i’m down! :stuck_out_tongue:


(Flippy) #9

I don’t think you’re all understanding his question.

He asks if it is possible, at all, to have ONE texture, just one, that (for example) covers the whole terrain of your map and still have different properties for different areas.

He does NOT mean having the same texture 5 times and applying these 5 textures (with different shaders) to different areas…

While I don’t know much about it I believe he wants to know if it’s possible to use something like the megatexture in ETQW, one giant texture with different properties in different places.

That is not possible, at all, in ET.


([Cerberus]) #10

From what I understand, the largest the texture can possibly be is 2048x2048.

You can do this, but you must have multiple editor images that all source the same texture. Each editor image should have the surfaceparms and such that you want for that particular texture version.

If you were asking if you can do various things in different places on the same texture, then the answer is NO, as Flippy has stated. But if you were, you could do the above and then place them on different brushes giving the appearance that its one texture.


(kamikazee) #11

From what I understand, the largest the texture can possibly be is 2048x2048.[/quote]Don’t forget to say they can be rectangular, eg. 256x128 or 4x64.

You can do this, but you must have multiple editor images that all source the same texture. Each editor image should have the surfaceparms and such that you want for that particular texture version.[/quote]Yes you can do it, but it’s impractical to handle. If the texture itself is composed of other textures, it’s better to split them. That way, you know that if you see a given texture, it is supposed to be eg. glass. Or you could go out and make editorimages, but that’s some work as well.

If you were asking if you can do various things in different places on the same texture, then the answer is NO, as Flippy has stated. But if you were, you could do the above and then place them on different brushes giving the appearance that its one texture.[/quote]This approach may as well create extra seams, so the best option remains to use different texture files.


([Cerberus]) #12

You can do this, but you must have multiple editor images that all source the same texture. Each editor image should have the surfaceparms and such that you want for that particular texture version.[/quote]
Yes you can do it, but it’s impractical to handle. If the texture itself is composed of other textures, it’s better to split them. That way, you know that if you see a given texture, it is supposed to be eg. glass. Or you could go out and make editorimages, but that’s some work as well.[/quote]
Totally, I guess I didnt state enough information, Just make the editor image the regular one just with writing on it, stating whats its function is.

EDIT Fixed the quoting error.


(kamikazee) #13

You seem to have a quoting error.

Oh, and I should say once again that I’m against using 1 texture with different shaders to achieve different properties. All I was saying is that it can be done, but it is far from practical.


(Flippy) #14

Also, wouldn’t it look weird to players to have the same texture make different sounds in different areas?


(aaa3) #15

ok i solved the problem, the needed areas are copied to 2 independent textures.

somebody else also asked, why.
well, i have a 1024x512 which contains the side, top, et c. views of the tank, with all the details also in it. i needed a some 16x16 area to emit light, and a 32x32 area of being nonsolid. so i wanted to have all the 1024x512 exist in 3 versions, normal, light emitting and nonsolid, but use the latter 2 only in some specific areas. because i had all the graphic work in that one, i doesnt needed a new texture file for them, since it would be unneccessary duplication. thats why i wanted to use more than 1 shader on 1 texture. then, i apply the whole tank the normal texture; and apply to the surface of tank light the light emitting version, and to some of the upper side of the tank the nonsolid version. i hope its clear what i wanted, i have read many weird guesses, like megatexture et c. :stuck_out_tongue:

now i copied the needed areas from the main texture and have 3 textures, 1024x512, 32x32 (light), 128x128 (nonsolid). but the graphic content in the small ones is also exist in the big so it wull need a bit more space in the pk3.

so i solved now and not important; but just for know… i guess now from all the above posts, its possible, but i MUST use editorimages to achieve it? then how to name the shaders?

textures/aaa_tank/stugiiib:q3map
{
	surfaceparm metalsteps
}

textures/aaa_tank/stugiiib_light
{
	q3map_lightRGB 1 1 1
	surfaceparm metalsteps
}

textures/aaa_tank/stugiiib_nonsolid:q3map
{
	surfaceparm metalsteps
	surfaceparm nonsolid
}

now i have this with the 3 files. (btw the light not works.) [edit: now it works, so everything is ok] and the files named stugiiib.tga, stugiiib_light.tga, and stugiiib_nonsolid.tga. but if i only used stugiiib.tga, then how to make the 3 shaders, when i have only one filename? if im right i cant use :q3map then but have to write all the shaders, using the same shader names as in the above example but giving manually the image path, like this:
{
map textures/castle/blocks11b.tga
}
?
(and i thought editorimages are not neccessary, just to make easier in the editor to know what properties the given surface have. but for me its ok the ‘shader image not found’ or, exactly the same as the normal, since i know where to applied which one. its quite obvious, given the subject)


(aaa3) #16

lol in this link the man uses 2 shaders with 1 common texture. this is the real solution, as it shows also how to implement it. (manually giving the same texture as base. and using 2 different shader name in the shader collection file) (am i right if i think that editorimage is unneccessary?)

and i uploaded a pre-release version of the prefab where i needed all this stuff so u can see why i needed it.

and now, as i see clear now how to implement it, i must counter kamikaze and decline that it is far away from practical (and that my request was without any point as some else said.)
i get can the same result as i got in my prefab, but without un-neccessary duplicating artwork (copying areas of the original big texture file and make a new file)