Hello, i try to apply a pbr texture with render pipeline to my object (like rock texture), but i have a black plane.
from __future__ import print_function
import os
import sys
from panda3d.core import Vec3, load_prc_file_data, ShaderTerrainMesh
from panda3d.core import NodePath, CardMaker, Texture
from panda3d.core import TextureStage
from direct.showbase.ShowBase import ShowBase
import numpy as np
import threading
import time
os.chdir(os.path.dirname(os.path.realpath(__file__)))
pipeline_path = "../../"
if not os.path.isfile(os.path.join(pipeline_path, "setup.py")):
pipeline_path = "../RenderPipeline/"
sys.path.insert(0, pipeline_path)
from rpcore import RenderPipeline
# This is a helper class for better camera movement - its not really
# a rendering element, but it included for convenience
from rpcore.util.movement_controller import MovementController
class Application(ShowBase):
def __init__(self):
# Setup window size, title and so on
load_prc_file_data("", """
win-size 1600 900
window-title Render Pipeline by tobspr
stm-max-chunk-count 2048
gl-coordinate-system default
stm-max-views 20
notify-level-linmath error
""")
self.render_pipeline = RenderPipeline()
self.render_pipeline.create(self)
# Set time of day
self.render_pipeline.daytime_mgr.time = "12:25"
self.set_background_color(0.1, 0.1, 0.1, 1)
self.controller = MovementController(self)
self.controller.set_initial_position_hpr(
Vec3(0, -10, 2), # Position : 10 unités derrière le plan et légèrement au-dessus.
Vec3(0, 0, 0) # Orientation : La caméra regarde vers l'origine.
)
self.controller.setup()
self.create_plane()
def create_plane(self):
cm = CardMaker("plane")
cm.set_frame(-2, 2, -2, 2)
plane = NodePath(cm.generate())
# PBR textures
tex_albedo = loader.load_texture("textures/PavingStones131_1K-JPG_Color.jpg") # Albedo map
tex_normal = loader.load_texture("textures/PavingStones131_1K-JPG_NormalGL.jpg") # Normal map
tex_roughness = loader.load_texture("textures/PavingStones131_1K-JPG_Roughness.jpg") # Roughness map
plane.set_texture(tex_albedo, 1)
plane.set_shader_input("normal_map", tex_normal)
plane.set_shader_input("roughness_map", tex_roughness)
plane.reparent_to(self.render)
plane.set_pos(0, 0, 0)
Application().run()
i use this texture:
I forgot something?
i have an other question, if i want to render a metal, i need to add an other texture like this, right ? like this:
tex_metallic = loader.load_texture("textures/stone_metallic.jpg")
plane.set_shader_input("metallic_map", tex_metallic)
i see that i can use a meterial object:
but is it compatible with render pipeline?
with only the texture, i have a black object too (but i have the texture without render pipeline)