DoerrSt Posted December 8, 2011 Share Posted December 8, 2011 Hi, I load models with the material automatically with LoadModel("...."). After the model is correctly loaded I try to change the material of this model (a modeller complaint about blurred textures - looks like I've to change the texture filter). The problem is that I can't get access to the material itself but not one of this commands returns a valid material: mat0=player.material mat1=player:GetChild(1).material mat2=GetEntityMaterial(player) mat3=GetEntityMaterial(player:GetChild(1)) If I use material=LoadMaterial("abstract::cobblestones.mat") ground=CreateCube() ground:SetScale(Vec3(100.0,1.0,100.0)) ground:SetPosition(Vec3(0.0,-2.0,0.0)) ground:Paint(material) the commands mat0=ground.material mat2=GetEntityMaterial(ground) are returning the correct value. Do I undestand something or do I've just found a bug? What I want to do is creating a look to set the texture filter for each material with PIXEL instead of MIPMAP: Thanks, Stefan Quote Link to comment Share on other sites More sharing options...
Rick Posted December 8, 2011 Share Posted December 8, 2011 In your first code that doesn't work are you loading a model with LoadModel() or are you doing that code in a model script in which the editor is loading the model for you? Quote Link to comment Share on other sites More sharing options...
DoerrSt Posted December 8, 2011 Author Share Posted December 8, 2011 Hi Rick, I load the model with LoadMode("mymodel.gmf"). This loads automatically the "mymodel.mat" and applies the materials. If I load the object in the model viewer the textures are automatically applied. The model script contains no code but on another model with code I've the same trouble. Regards, Stefan Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 9, 2011 Share Posted December 9, 2011 i dont currently have access to LE but this should work as i have done similar code in the past in lua: mat1 = GetSurfaceMaterial(GetSurface(model:GetChild(1),1))) of course this assumes the material you want is on Surface1 of the mesh... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Matthew Nicholls Posted December 9, 2011 Share Posted December 9, 2011 If you are getting "blurred textures" don't you just need to set the anisotropic filter using framework AFilter( 4 ) Sets the anisotropic filter. The mode can be from 1 to the value returned by MaxAFilter(). Quote Link to comment Share on other sites More sharing options...
DoerrSt Posted December 9, 2011 Author Share Posted December 9, 2011 Got it, thanks guys. AFilter was set to 8 but the TextureFilter setting changed to smooth improved the rendering quality. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.