Yes, you can write code to create RP materials. However, I repeat, you need to study the models again. And these sections:
Manual
https://docs.panda3d.org/1.10/python/programming/texturing/index
https://docs.panda3d.org/1.10/python/programming/render-attributes/materials
API
https://docs.panda3d.org/1.10/python/reference/panda3d.core.Texture
https://docs.panda3d.org/1.10/python/reference/panda3d.core.TextureStage
https://docs.panda3d.org/1.10/python/reference/panda3d.core.Material
This way you can find out the initial parameters of the models that come with RP. Please note that the order of the stages for textures is important.
from direct.showbase.ShowBase import ShowBase
from panda3d.core import MaterialAttrib, TextureAttrib
class App(ShowBase):
def __init__(self):
ShowBase.__init__(self)
scene = loader.load_model("Scene.bam")
for node_path in scene.find_all_matches('**/+GeomNode'):
geom_states = node_path.node().get_geom_states()
print(node_path.name)
for geom_state in geom_states:
if geom_state.has_attrib(MaterialAttrib):
print(geom_state.get_attrib(MaterialAttrib).get_material())
if geom_state.has_attrib(TextureAttrib):
texture_stages = geom_state.get_attrib(TextureAttrib).get_on_stages()
for texture_stage in texture_stages:
print(texture_stage, geom_state.get_attrib(TextureAttrib).get_on_texture(texture_stage))
print("------------------------")
app = App()
app.run()
out:
2.003
Material
base_color = 0.195987 0.195987 0.195987 1
refractive_index = 1.38467
emission = 0 0 0 0
roughness = 0.629749
metallic = 0
local = 0
twoside = 0
TextureStage empty_basecolor-0, sort = 0, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_basecolor.png (from /d/Code/RenderPipeline/test/scene/tex/empty_basecolor.png)
2-d, 2 x 2 pixels, each 3 bytes, srgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
TextureStage empty_normal-10, sort = 10, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_normal.png (from /d/Code/RenderPipeline/test/scene/tex/empty_normal.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_specular-20, sort = 20, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_specular.png (from /d/Code/RenderPipeline/test/scene/tex/empty_specular.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_roughness-30, sort = 30, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_roughness.png (from /d/Code/RenderPipeline/test/scene/tex/empty_roughness.png)
2-d, 2 x 2 pixels, each 3 bytes, rgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
------------------------
1.002
Material
base_color = 1 1 1 1
refractive_index = 1.5
emission = 0 0 0 0
roughness = 0.3
metallic = 0
local = 0
twoside = 0
TextureStage BackDiff-0, sort = 0, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture pattern.png (from /d/Code/RenderPipeline/test/scene/tex/pattern.png)
2-d, 128 x 128 pixels, each 4 bytes, srgb_alpha
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 65536 bytes in ram, compression off
TextureStage empty_normal-10, sort = 10, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_normal.png (from /d/Code/RenderPipeline/test/scene/tex/empty_normal.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_specular-20, sort = 20, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_specular.png (from /d/Code/RenderPipeline/test/scene/tex/empty_specular.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_roughness-30, sort = 30, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_roughness.png (from /d/Code/RenderPipeline/test/scene/tex/empty_roughness.png)
2-d, 2 x 2 pixels, each 3 bytes, rgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
------------------------
3.003
Material
base_color = 0.486 0.631 0.663 1
refractive_index = 1.40974
emission = 0 0 0 0
roughness = 0.0544803
metallic = 0
local = 0
twoside = 0
TextureStage empty_basecolor-0, sort = 0, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_basecolor.png (from /d/Code/RenderPipeline/test/scene/tex/empty_basecolor.png)
2-d, 2 x 2 pixels, each 3 bytes, srgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
TextureStage empty_normal-10, sort = 10, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_normal.png (from /d/Code/RenderPipeline/test/scene/tex/empty_normal.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_specular-20, sort = 20, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_specular.png (from /d/Code/RenderPipeline/test/scene/tex/empty_specular.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_roughness-30, sort = 30, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_roughness.png (from /d/Code/RenderPipeline/test/scene/tex/empty_roughness.png)
2-d, 2 x 2 pixels, each 3 bytes, rgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
------------------------
3.002
Material
base_color = 0.486 0.631 0.663 1
refractive_index = 1.40974
emission = 0 0 0 0
roughness = 0.0544803
metallic = 0
local = 0
twoside = 0
TextureStage empty_basecolor-0, sort = 0, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_basecolor.png (from /d/Code/RenderPipeline/test/scene/tex/empty_basecolor.png)
2-d, 2 x 2 pixels, each 3 bytes, srgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
TextureStage empty_normal-10, sort = 10, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_normal.png (from /d/Code/RenderPipeline/test/scene/tex/empty_normal.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_specular-20, sort = 20, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_specular.png (from /d/Code/RenderPipeline/test/scene/tex/empty_specular.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_roughness-30, sort = 30, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_roughness.png (from /d/Code/RenderPipeline/test/scene/tex/empty_roughness.png)
2-d, 2 x 2 pixels, each 3 bytes, rgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
------------------------
1.001
Material
base_color = 1 1 1 1
refractive_index = 1.5
emission = 0 0 0 0
roughness = 0.3
metallic = 0
local = 0
twoside = 0
TextureStage BackDiff-0, sort = 0, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture pattern.png (from /d/Code/RenderPipeline/test/scene/tex/pattern.png)
2-d, 128 x 128 pixels, each 4 bytes, srgb_alpha
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 65536 bytes in ram, compression off
TextureStage empty_normal-10, sort = 10, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_normal.png (from /d/Code/RenderPipeline/test/scene/tex/empty_normal.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_specular-20, sort = 20, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_specular.png (from /d/Code/RenderPipeline/test/scene/tex/empty_specular.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_roughness-30, sort = 30, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_roughness.png (from /d/Code/RenderPipeline/test/scene/tex/empty_roughness.png)
2-d, 2 x 2 pixels, each 3 bytes, rgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
------------------------
2.002
Material
base_color = 0.195987 0.195987 0.195987 1
refractive_index = 1.38467
emission = 0 0 0 0
roughness = 0.629749
metallic = 0
local = 0
twoside = 0
TextureStage empty_basecolor-0, sort = 0, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_basecolor.png (from /d/Code/RenderPipeline/test/scene/tex/empty_basecolor.png)
2-d, 2 x 2 pixels, each 3 bytes, srgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
TextureStage empty_normal-10, sort = 10, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_normal.png (from /d/Code/RenderPipeline/test/scene/tex/empty_normal.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_specular-20, sort = 20, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_specular.png (from /d/Code/RenderPipeline/test/scene/tex/empty_specular.png)
2-d, 2 x 2 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 16 bytes in ram, compression off
TextureStage empty_roughness-30, sort = 30, priority = 0
texcoords = texcoord, mode = modulate, color = 1 1 1 1, scale = 1, 1, saved_result = 0, tex_view_offset = 0
2d_texture empty_roughness.png (from /d/Code/RenderPipeline/test/scene/tex/empty_roughness.png)
2-d, 2 x 2 pixels, each 3 bytes, rgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=16) lod(min=-1000, max=1000, bias=0) 12 bytes in ram, compression off
...